In the little games I made in pygame there's always a box around my cursor in which all colours are reversed (e.g. if I hold my cursor over a black and red background the square around the cursor will be white and cyan). This initially wasn't a problem, since the first few projects only required keyboard inputs, but now I want to make a game where you have to click a lot, so it would look very ugly. How do I remove this box? I am using macOS High Sierra, python3 and pygame 1.9.3.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
I'm putting this as an answer, because it's too much for a comment. Also, I don't have a Mac, so this answer is supposition.
Looking at the github issue @Keno posted:
There's an image of a white cursor (black filled outline), on a black background.
It looks to me, that with the latest OS upgrade, MacOS is no longer working correctly with whatever mouse-cursor-image functions PyGame is using. Obviously the pixels outside the cursor should be transparent.
Anecdotal evidence (i.e.: a google search) suggests that other software has cursor issues with macOS High Sierra too.
Maybe it's possible to work around the problem.
If the PyGame application is not using the mouse, it may be useful to just hide the cursor.
However if PyGame is "hiding" the mouse by setting a fully-transparent cursor, the result may still be a completely black square. So the mouse can be moved outside the window (or at least to the bottom-right corner):
I got a bit carried away with this problem, and ended up writing a bunch of test cases.
EDIT: I forgot to upload the
finger_cursor_16.png
image:Just adding to @Kingsley answer without the tests and out of window cursor detection, still super hacky and probably more trouble than it's worth but might help you while there's a fix.