classification
Title: Tkinter root window won't close if packed.
Type: behavior Stage: resolved
Components: macOS, Tkinter Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched
View: 38946
Assigned To: Nosy List: Sam Yeager, ned.deily, ronaldoussoren, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2016-02-17 15:00 by Sam Yeager, last changed 2020-10-19 19:47 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
1 Before closing root window.png Sam Yeager, 2016-02-19 18:54
2 After closing root window.png Sam Yeager, 2016-02-19 18:55
Messages (13)
msg260400 - (view) Author: Sam Yeager (Sam Yeager) Date: 2016-02-17 15:00
Using the following code, the root window will not close properly when the close icon is clicked:

from tkinter import *
rootWin = Tk()
l = Label(rootWin, text="foo")
l.pack()

Similar issue occurs with Tk.grid().


OS: Mac OS X 10.10.5
Python IDE: IDLE 3.4.4
tkinter.TkVersion: 8.5
tkinter.TclVersion: 8.5
ActiveTcl: 8.6.4
msg260402 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-17 16:07
What do you mean with "properly"? All looks good to me on Linux.
msg260413 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-02-17 23:18
Also note that installing ActiveTcl 8.6.x has no effect if the tkinter in use was linked with an 8.5 version of Tcl/Tk, as the one you are using apparently was. Make sure you have installed the latest version of ActiveTcl 8.5.x and try again.
msg260527 - (view) Author: Sam Yeager (Sam Yeager) Date: 2016-02-19 18:54
I've reverted to ActiveTcl 8.5.18. Issue persists.

Uploading screenshots before and after attempting to close root window.
msg260544 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-02-20 00:45
No problem on Windows either, where the minimum window width is wide enough to acommodate all 3 frame buttons (-  []  X).

Please run your test.py directly, either in the terminal or however else one does so on OSX, without IDLE, to make absolutely sure that IDLE has no effect on the behavior.  (It really ought not to.)
msg260697 - (view) Author: Sam Yeager (Sam Yeager) Date: 2016-02-22 20:30
Ran script on Terminal. The issue disappears, and everything works normally.

Running through IDLE, the issue returns. Sorry, Terry.
msg260721 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-02-23 10:05
I was running from IDLE when I said no problem on Windows, so this is OSX specific.  Are you running same version of python  (splash message) and tcl/tk?  (on IDLE, Help => About IDLE).  Does Python on OSX have equivalent of pythonw.exe?  If you start IDLE at terminal and then run from IDLE, do you see and error message in the terminal?
msg260751 - (view) Author: Sam Yeager (Sam Yeager) Date: 2016-02-23 23:39
It's almost certainly only found on OSX. I'm currently taking a Python class of approximately 150 students, and at least two of us independently found this issue on our respective Macs.

IDLE and Python are the same version (v3.4.4). The info window lists Tk as version 8.5.18, which matches the version ActiveTcl.

I'm not familiar with pythonw.exe as I've been using Mac.

Entering "idle 3.4" at Terminal opens IDLE as a separate app and Terminal waits until the app is closed. While running the script in the app, the issue persists.
msg260762 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-24 07:46
If the problem is that the window is too small to contain the close icon, this is not Python issue. May be this is Tk issue or end application issue.
msg260818 - (view) Author: Sam Yeager (Sam Yeager) Date: 2016-02-24 16:47
This occurs even when the window is large and/or packed with multiple elements.
msg378955 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-19 15:37
I cannot reproduce this issue with Python 3.9 (Python.org installer). 

Both with "Run Module" and in the interactive shell (both in IDLE) the window will close properly.  In both cases the window it too small to show the minimise and maximise buttons (as in the original screenshots), but that's not something we can fix on the Python side. 

I propose closing this issue as "out of date".
msg378985 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-10-19 18:52
Unfortunately, I can reproduce it, or at least odd behavior when run from an IDLE.app edit window on with 3.9.0 on macOS 10.15. By observing the macOS Dock while running this, it looks like a second Python app instance is created while running this. We have seen similar behavior as documented in Issue38946. I have an idea what's going on there which I'll try to look at this week.  Let's close this as a duplicate so it's not forgotten.
msg379002 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-10-19 19:47
I just reproduced this too with Airbook Mohave.  When IDLE's Shell is running, it is linked to an execution subprocess that is initially invisible, unless and until the user creates a visible window.  Tk() does this.  On Windows, a tk Window icon appears when I mouse over the IDLE taskbar icon.  On Mac, a new python rocket icon, also used for Python Launcher, appears.  And it becomes the active app for the Apple menu bar, making it more tied to the OS than on Windows.  In either case, I can switch between IDLE and tk windows by clicking icons or sub-icons.

When I click the red close button on the tk window, it disappears, but the rocket app icon is still there.  Clicking it maybe restores the window, which was hidden, not closed.  Or I may have to right click the rocket and then 'tk'.  Right-clicking the rocket and then 'quit' fails to close.  But trying to modify the tk window may fail with 'app destroyed' even though it can be made visible.  Closing the parent IDLE closes the Window.
History
Date User Action Args
2020-10-31 23:24:05terry.reedylinkissue26377 superseder
2020-10-19 19:47:31terry.reedysetmessages: + msg379002
2020-10-19 18:52:34ned.deilysetstatus: pending -> closed
superseder: IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched
messages: + msg378985

resolution: out of date -> duplicate
stage: resolved
2020-10-19 15:37:55ronaldoussorensetstatus: open -> pending
resolution: out of date
messages: + msg378955
2016-02-24 16:47:31Sam Yeagersetmessages: + msg260818
2016-02-24 07:46:54serhiy.storchakasetmessages: + msg260762
2016-02-23 23:39:42Sam Yeagersetmessages: + msg260751
2016-02-23 10:05:51terry.reedysetmessages: + msg260721
2016-02-22 20:30:03Sam Yeagersetmessages: + msg260697
2016-02-20 00:45:05terry.reedysetnosy: + terry.reedy
messages: + msg260544
components: - IDLE
2016-02-19 18:55:02Sam Yeagersetfiles: + 2 After closing root window.png
2016-02-19 18:54:53Sam Yeagersetfiles: + 1 Before closing root window.png

messages: + msg260527
2016-02-17 23:18:40ned.deilysetmessages: + msg260413
2016-02-17 16:07:54serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg260402
2016-02-17 15:01:48Sam Yeagersetfiles: - Screen Shot 2016-02-17 at 10.00.21 AM.png
2016-02-17 15:00:45Sam Yeagercreate