|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
New Tkinter windows don't steal focus when spawned from TerminalI recently asked a Tkinter question on the comp.lang.python usenet group, but I thought it might also be relevant to this mailing list. The thread can be read at http://groups.google.com/group/comp.lang.python/browse_frm/thread/64f3bc64de5dc773/, and excerpts are also included below. If anyone has any info about whether this is possible, it would be much appreciated.
Thanks! Josh P.S. Please Cc jabronson@... on your reply.
Forwarded conversation Subject: New Tkinter windows don't get focus on OS X ------------------------ From: Joshua Bronson <jabronson@...> Date: Thu, Sep 10, 2009 at 1:27 AM To: jabronson@... 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 ---------- From: Joshua Bronson <jabronson@...> Date: Thu, Sep 10, 2009 at 1:29 AM To: jabronson@... http://groups.google.com/group/comp.lang.python/browse_frm/thread/64f3bc64de5dc773/ ---------- From: Kevin Walzer <kw@...> Date: Thu, Sep 10, 2009 at 10:12 AM To: Joshua Bronson <jabronson@...>
Yes, this is standard behavior for OS X. Running an app in Terminal keeps focus in the Terminal unless you switch by clicking windows. The Command-Tab behavior is determined by the windowing system, not by a newly spawned process. The way around this is to wrap your application up in a standard Mac app bundle using py2app. The average Mac user isn't going to launch a Python-based game from the command line. Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ---------- From: Kevin Walzer <kw@...> Date: Thu, Sep 10, 2009 at 5:38 PM To: Joshua Bronson <jabronson@...> Hi Joshua, At first I was puzzled by this, because if you run something like OK...
I've confirmed this with wx...not sure why Tk behaves differently. True, but it'll still be a lot less painful for me to test my app if I I'm not sure there's a way to do this. --Kevin ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
New Tkinter windows don't steal focus when spawned from TerminalI recently asked a Tkinter question on the comp.lang.python usenet group, but I thought it might also be relevant to this mailing list. The thread can be read at http://groups.google.com/group/comp.lang.python/browse_frm/thread/64f3bc64de5dc773/, and excerpts are also included below. Any help would be much appreciated.
Thanks! Josh 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.... Every other GUI toolkit I've used (e.g. wxPython, PyQt4, pyglet) does not have this problem. (If you try the basic example from http://www.wxpython.org/tut-part1.php you'll see what I mean.) How are these other toolkits able to steal the focus? More important, is it possible to have a Tkinter app steal the focus, even if it's not the default behavior? ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
| Free embeddable forum powered by Nabble | Forum Help |