classification
Title: modal dialog with transient method; parent window fails to iconify
Type: behavior Stage: resolved
Components: Tkinter, Windows Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: Vladimir Semenenko, jarb, paul.moore, serhiy.storchaka, steve.dower, terry.reedy, tim.golden, vs, zach.ware
Priority: normal Keywords:

Created on 2016-02-11 17:05 by vs, last changed 2017-12-09 01:25 by Vladimir Semenenko. This issue is now closed.

Files
File name Uploaded Description Edit
issue26340.tcl serhiy.storchaka, 2016-02-13 07:44
Messages (8)
msg260114 - (view) Author: (vs) Date: 2016-02-11 17:05
Consider the following code implementing a custom modal dialog:

from Tkinter import *

def dialog():
    win = Toplevel()
    Label(win, text='Modal Dialog').pack()
    win.transient(win.master)
    win.focus_set()
    win.grab_set()
    win.wait_window()

root = Tk()
Button(root, text='Custom Dialog', command=dialog).pack()
root.mainloop()

In Python 2.7.3, the parent window behaves as expected when the modal dialog is active. That is, the parent window responds to minimize, maximize, and close events. The modal dialog window iconifies and closes together with the parent window. If a user presses Show Desktop button in Windows OS, the parent and the dialog iconify together and can be restored from the Taskbar.

However, in more recent Python releases (I tested 2.7.8, 2.7.11 and 3.5.1), the parent window does not respond to any of the three window commands. If the modal dialog is open and the user presses Show Desktop, both windows iconify, but they CANNOT be restored or closed from the Taskbar. The only way to close such an application is to kill it through the Task Manager.
msg260213 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-02-12 23:34
I changed 'Tkinter' to 'tkinter' and added 'root' to the Toplevel call and got the same behavior running from IDLE on Win10.  I am not sure this is a python bug, as opposed to a change in behavior.  Modal dialogs tend to disable everything else and tk and or Windows might have changed from 2.7.3.
msg260226 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-13 07:44
Here is an equivalent code on Tcl. It behaves as expected on Linux with Tk 8.6 and 8.4. The parent window responds to minimize, maximize, and close events. The modal dialog window iconifies and closes together with the parent window.

Could you test it on Windows?
msg260246 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-02-13 19:55
How do I run it?  "tcl is not recognized ..."
msg260247 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-02-13 20:15
As near as I can tell, the Windows installer installs tcl/tk libraries but no executable. Perhaps your example could be converted to root.tk.call(? ? ?) form, but I do not know how to do do.  Passing the entire tcl program as one python string argument does not work.
msg260252 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-13 21:43
You need to install Tcl/Tk separately (e.g. ActiveTcl) and use the "wish" command.
msg307858 - (view) Author: jarb (jarb) Date: 2017-12-08 17:32
I am having the exactly same issue. Was this issue resolved for Windows 10? This does not happen in Linux. Any workaround for Windows 10?
msg307874 - (view) Author: Vladimir Semenenko (Vladimir Semenenko) Date: 2017-12-09 01:25
After they marked the issue as "resolved" earlier this year I tested a
subsequent 3.x release in Windows 7 and Vista (I don't have 10). The issue
was still there.

I don't have a workaround. I am forced to stay with 2.7.3.

On Dec 8, 2017 9:32 AM, "jarb" <report@bugs.python.org> wrote:

jarb <jinhyok.heo@arb.ca.gov> added the comment:

I am having the exactly same issue. Was this issue resolved for Windows 10?
This does not happen in Linux. Any workaround for Windows 10?

----------
nosy: +jarb

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue26340>
_______________________________________
History
Date User Action Args
2017-12-09 01:25:20Vladimir Semenenkosetnosy: + Vladimir Semenenko
messages: + msg307874
2017-12-08 17:32:00jarbsetnosy: + jarb
messages: + msg307858
2017-03-07 18:44:08serhiy.storchakasetstatus: pending -> closed
resolution: works for me
stage: resolved
2016-10-24 19:57:10serhiy.storchakasetstatus: open -> pending
2016-02-13 21:43:15serhiy.storchakasetmessages: + msg260252
2016-02-13 20:15:08terry.reedysetmessages: + msg260247
2016-02-13 19:55:59terry.reedysetmessages: + msg260246
2016-02-13 07:44:25serhiy.storchakasetfiles: + issue26340.tcl

messages: + msg260226
2016-02-12 23:34:21terry.reedysetnosy: + terry.reedy, serhiy.storchaka

messages: + msg260213
versions: + Python 3.6
2016-02-11 17:05:42vscreate