[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] keeping focus on app on windows platform
Ricardo Jamin wrote:
Is there a way to keep the focus, or regain in it right away when
lost. Simple workaround is to alt-tab back, but it looks less
> professional to the client.
I believe if you grab the input your system will remain active. Call
"pygame.event.set_grab(True)". If that doesn't do it things are going to
get tricky.
You can detect when the application does get pushed back by watching for
ACTIVEEVENT. The "gain" attribute will be set to 0, and there are
several states you can watch for. Look at SDL_ActiveEvent for a little
more info. http://sdldoc.csn.ul.ie/sdlactiveevent.php
When your application does lose focus, you could potentially call
pygame.display.set_mode() again and force your window back to
FULLSCREEN. Things may flicker a bit as your program switches away and
right back. But in the end it will be your program that wins.