classification
Title: Menu.tk_popup : menu doesn't disapear when main window is iconified.
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, marc.dechico, ned.deily
Priority: normal Keywords:

Created on 2012-02-10 10:50 by marc.dechico, last changed 2014-07-03 08:05 by ned.deily. This issue is now closed.

Files
File name Uploaded Description Edit
popupmenu.py marc.dechico, 2012-02-10 10:50 py source using Menu.tk_popup
Messages (3)
msg153037 - (view) Author: marc dechico (marc.dechico) Date: 2012-02-10 10:50
actions do discover the bug  with the source I have given:

pushing the right button to get the pop-up menu .

going out of the popup_menu  still pushing the right button.

the menu doesn't disapear when releasing the button.

and still doesn't disapear when iconnifying the main window.

I suppose the pop up_menu  should behave in a transient way.

when doing such a thing with google-chrome I first have my popup menu disapear and I need to click again to iconify.

perhaps we should have the choice and have access to a transient function.
msg222128 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-02 21:23
@marc please accept our apologies for having missed this.

Can someone comment on this please.
msg222155 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-07-03 08:05
As far as I can tell, the problem you are seeing with the menu not disappearing when iconifying is caused by the use of grab_release() in do_popup().  If I remove it, using an X11-based Tk 8.6, the focus stays on the menu and clicking on the iconify button causes the menu to be dismissed.  With grab_release(), the focus is released from the menu and clicking on the iconify button causes the menu to stay.  Unfortunately, there are differences among the various Tk releases and, with the same release, among platform implementations (Windows Tk, X11 Tk, OS X Cocoa Tk, etc).  Another issue was the use of the 0 "entry" argument on the call on tk_popup call.  With the X11 Tk I tested with, that caused the menu to flash and disappear when clicking the window; removing the 0 argument caused the menu to stay as expected.  With an OS X Cocoa Tk, your original test case worked fine without modification.  A good modern resource for using Tk is the TkDocs website, which covers use of Tk from Tcl, Python, Ruby, and Perl.  The menus sections describes some of the platform differences you may encounter and need to deal with:

http://www.tkdocs.com/tutorial/menus.html
History
Date User Action Args
2014-07-03 08:05:25ned.deilysetstatus: open -> closed

nosy: + ned.deily
messages: + msg222155

resolution: not a bug
stage: resolved
2014-07-02 21:23:11BreamoreBoysetnosy: + BreamoreBoy
messages: + msg222128
2012-02-10 10:50:22marc.dechicocreate