classification
Title: Tkinter windows pop under the terminal in OSX
Type: behavior Stage: needs patch
Components: IDLE, Macintosh, Tkinter Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder: Turtle window pops under the terminal on OSX
View: 11571
Assigned To: ned.deily Nosy List: belopolsky, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2010-07-26 16:45 by belopolsky, last changed 2011-03-16 15:01 by belopolsky. This issue is now closed.

Messages (9)
msg111641 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-26 16:44
I believe any Tkinter app will exhibit the same behavior, but I discovered this with idle and verified with wish.py:


$ ./python.exe Demo/tkinter/guido/wish.py 
% quit
Traceback (most recent call last):
  File "Demo/tkinter/guido/wish.py", line 22, in <module>
    if tk.getboolean(tk.call('info', 'complete', cmd)):
_tkinter.TclError: expected boolean value but got ""


Note that the Traceback above is probably due to another bug.

If you start wish.py from a terminal covering the top left corner of the screen, the wish window will appear under the terminal window.
msg111676 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-27 01:20
This is probably Tk issue, but there might me a way that tkinter can work around it.   On OSX 10.6, the pre-installed /usr/bin/wish shows the same behavior, but mac ports' /opt/local/bin/wish works fine.
msg111689 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-07-27 05:54
I was more interested in the other problem you mentioned about "pydoc -g" crashing when you search for something.

Does "pydoc -k" also crash?  The -g option works for me, working or not working depends on the set of installed python packages as the search option, like "pydoc -k", searches through the docstrings of all availables modules/packages.
msg111698 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-27 14:38
On Tue, Jul 27, 2010 at 1:54 AM, Ronald Oussoren <report@bugs.python.org> wrote:
..
> Does "pydoc -k" also crash?

Yes, it does:

$ ./python.exe -m pydoc -k xyz
lib2to3.fixes.fix_repr - Fixer that transforms `xyzzy` into repr(xyzzy).
Segmentation fault

but this is not an OSX specific issue.  I believe this is the same as issue9319.
msg130421 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-03-09 04:33
The placement of Tk windows is dependent on the version of Tk and platform window manager.  The Aqua Tk version on Mac OS X run as a separate GUI application process and so, as is customary, the focus and window stacking does not change when it is launched.  The platform-independent way to ensure the newly-created Tk window is on top is to set the "topmost" attribute on the root window:

   tk = _tkinter.create(os.environ['DISPLAY'], 'wish', 'Tk', 1)
   tk.call('update')
   tk.call('wm', 'attributes', '.', '-topmost', '1')
   ...

http://www.tcl.tk/man/tcl8.5/TkCmd/wm.htm#M10

I suppose we could add something like that to IDLE on OS X when it creates its initial shell window.
msg131119 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-03-16 14:18
This is not a bug in python, but is generic platform behavior (as Ned noted). I'll therefore close this issue as won't fix.
msg131120 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011-03-16 14:31
On Wed, Mar 16, 2011 at 10:18 AM, Ronald Oussoren
<report@bugs.python.org> wrote:
..
> This is not a bug in python, but is generic platform behavior (as Ned noted).

Maybe not a bug in tkinter proper, but certainly an unexpected
behavior when running tkinter demo scripts or say turtle module.   The
later is particularly troublesome because its target audience is
novice users and to see terminal effectively freeze on "python -m
turtle" because all the action is happening behind the terminal is
rather surprising.

Maybe turtle should set '-topmost' WM attribute on its main window?
msg131122 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-03-16 14:42
Maybe.  It is definitely something that will have to be determined for every case separately and is not something that should be worked around in Tkinter itself.
msg131125 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011-03-16 15:01
On Wed, Mar 16, 2011 at 10:42 AM, Ronald Oussoren
<report@bugs.python.org> wrote:
> It is definitely something that will have to be determined for every case separately
> and is not something that should be worked around in Tkinter itself.

I agree, but I don't know how to achieve the desired behavior in the
case of turtle where interaction often happens in the terminal and
result displayed in a separate window.  See issue11571.
History
Date User Action Args
2011-03-16 15:01:36belopolskysetmessages: + msg131125
2011-03-16 15:01:16belopolskysetsuperseder: Turtle window pops under the terminal on OSX
2011-03-16 14:58:04belopolskylinkissue11571 dependencies
2011-03-16 14:42:42ronaldoussorensetmessages: + msg131122
2011-03-16 14:31:36belopolskysetmessages: + msg131120
2011-03-16 14:18:16ronaldoussorensetstatus: open -> closed

messages: + msg131119
resolution: wont fix
2011-03-09 04:33:51ned.deilysetnosy: + ned.deily
messages: + msg130421

assignee: ronaldoussoren -> ned.deily
stage: needs patch
2010-07-27 14:38:47belopolskysetmessages: + msg111698
2010-07-27 05:54:35ronaldoussorensetmessages: + msg111689
2010-07-27 01:20:20belopolskysetmessages: + msg111676
2010-07-26 16:45:00belopolskycreate