Skip to content
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

Tkinter windows pop under the terminal in OSX #53630

Closed
abalkin opened this issue Jul 26, 2010 · 9 comments
Closed

Tkinter windows pop under the terminal in OSX #53630

abalkin opened this issue Jul 26, 2010 · 9 comments
Assignees
Labels
OS-mac topic-IDLE topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@abalkin
Copy link
Member

abalkin commented Jul 26, 2010

BPO 9384
Nosy @ronaldoussoren, @abalkin, @ned-deily
Superseder
  • bpo-11571: Turtle window pops under the terminal on OSX
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ned-deily'
    closed_at = <Date 2011-03-16.14:18:16.076>
    created_at = <Date 2010-07-26.16:45:00.064>
    labels = ['OS-mac', 'expert-IDLE', 'type-bug', 'expert-tkinter']
    title = 'Tkinter windows pop under the terminal in OSX'
    updated_at = <Date 2011-03-16.15:01:36.841>
    user = 'https://github.com/abalkin'

    bugs.python.org fields:

    activity = <Date 2011-03-16.15:01:36.841>
    actor = 'belopolsky'
    assignee = 'ned.deily'
    closed = True
    closed_date = <Date 2011-03-16.14:18:16.076>
    closer = 'ronaldoussoren'
    components = ['IDLE', 'macOS', 'Tkinter']
    creation = <Date 2010-07-26.16:45:00.064>
    creator = 'belopolsky'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 9384
    keywords = []
    message_count = 9.0
    messages = ['111641', '111676', '111689', '111698', '130421', '131119', '131120', '131122', '131125']
    nosy_count = 3.0
    nosy_names = ['ronaldoussoren', 'belopolsky', 'ned.deily']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'needs patch'
    status = 'closed'
    superseder = '11571'
    type = 'behavior'
    url = 'https://bugs.python.org/issue9384'
    versions = []

    @abalkin
    Copy link
    Member Author

    abalkin commented Jul 26, 2010

    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.

    @abalkin
    Copy link
    Member Author

    abalkin commented Jul 27, 2010

    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.

    @ronaldoussoren
    Copy link
    Contributor

    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.

    @abalkin
    Copy link
    Member Author

    abalkin commented Jul 27, 2010

    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 bpo-9319.

    @ned-deily
    Copy link
    Member

    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.

    @ned-deily ned-deily assigned ned-deily and unassigned ronaldoussoren Mar 9, 2011
    @ronaldoussoren
    Copy link
    Contributor

    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.

    @abalkin
    Copy link
    Member Author

    abalkin commented Mar 16, 2011

    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?

    @ronaldoussoren
    Copy link
    Contributor

    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.

    @abalkin
    Copy link
    Member Author

    abalkin commented Mar 16, 2011

    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 bpo-11571.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-mac topic-IDLE topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants