New Tkinter windows don't get focus on OS X

Joshua Bronson jabronson at gmail.com
Thu Sep 10 07:27:28 CEST 2009


If you try something like:

$ python -m Tkinter -c 'Tkinter._test()'

in Terminal on OS X, you'll notice that the window that is spawned
does not get focus, rather focus remains in Terminal. Furthermore, if
you hit Command+Tab to switch focus to the Python process, you'll
notice that for some reason Python has been placed last in the focus
order, even though it was just spawned by Terminal. This is
undesirable if you're e.g. making a game where stuff happens as soon
as the window is spawned and the player is expected to respond quickly
but can't until she Command+Tabs over or clicks in the unfocused
window. I've googled for this extensively and haven't found a way
around it, so I thought I'd ask here. If there is a more appropriate
place to ask, please let me know.

Thanks,
Josh



More information about the Python-list mailing list