Issue 26340: modal dialog with transient method; parent window fails to iconify (original) (raw)

Created on 2016-02-11 17:05 by vs, last changed 2022-04-11 14:58 by admin. This issue is now closed.

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

2022-04-11 14:58:27

admin

set

github: 70528

2017-12-09 01:25:20

Vladimir Semenenko

set

nosy: + Vladimir Semenenko
messages: +

2017-12-08 17:32:00

jarb

set

nosy: + jarb
messages: +

2017-03-07 18:44:08

serhiy.storchaka

set

status: pending -> closed
resolution: works for me
stage: resolved

2016-10-24 19:57:10

serhiy.storchaka

set

status: open -> pending

2016-02-13 21:43:15

serhiy.storchaka

set

messages: +

2016-02-13 20:15:08

terry.reedy

set

messages: +

2016-02-13 19:55:59

terry.reedy

set

messages: +

2016-02-13 07:44:25

serhiy.storchaka

set

files: + issue26340.tcl

messages: +

2016-02-12 23:34:21

terry.reedy

set

nosy: + terry.reedy, serhiy.storchaka

messages: +
versions: + Python 3.6

2016-02-11 17:05:42

vs

create