-
-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct pygame.display
stubs
#3264
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, thanks! 🎉
Left a minor review comment, but that won't stop my approval
I'm slightly unsure about this. When I work on apps or games I don't enable type checkers, so this won't really affect me, but when I work on mili I do for people's sake and every time there is X|None I have to guard it at every usage. The reason I'm not sure it's because whether the function returns None doesn't depend on input or calculations but rather on the state of the program that a type checker can never know, meaning it'll always complain, even if you are sure the code path is going to run after display initialization. I guess you can just blame this on the limitations of type checkers, and that the stubs mustn't lie to a user just because of it, and I can't complain on that, so I'll not stop this. I don't use this function either (window api on TOP), I was just rambling in the perspective on someone else (but at the same time, if they are good enough to use type checkers, they are good enough to use the window api lol) |
Added an overload for no-argument |
I agree that it may inconvenience users who rely on this function to grab the display. They will probably have to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
pygame.display.get_surface()
can returnNone
if no display is initialized yet.This correction may cause type checking errors in existing codebases.
pygame.display.update()
can takefloat
s for pixel coordinates, truncating them as usual.