classification
Title: Make Tkinter.py's nametowidget work with cloned menu widgets
Type: Stage:
Components: Tkinter Versions: Python 3.1, Python 3.0, Python 2.7, Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: gpolo, gregcouch, jepler (3)
Priority: normal Keywords patch

Created on 2003-05-07 20:11 by gregcouch, last changed 2008-12-31 17:04 by gpolo.

Files
File name Uploaded Description Edit Remove
Tkinter.py.diffs gregcouch, 2003-05-07 20:11 nametowidget patch for cloned widgets
nametowidget_clonedmenus.diff gpolo, 2008-12-31 17:04
Messages (3)
msg43671 - (view) Author: Greg Couch (gregcouch) Date: 2003-05-07 20:11
Tk will clone menu widgets when they are torn off and
it gives them names at are similar to the original
widget's names.  The patch extends the nametowidget so
it will return the original widget when given the name
of a cloned widget.  We used this patch to provide
balloon help in cloned menus.  This patch isn't
perfect, it will fail on clones of clones, but it is a
big help.

This patch was made against the latest CVS version
1.173 of Tkinter.py but works against older
Tkinter.py's too.

     - Greg Couch
msg43672 - (view) Author: Jeff Epler (jepler) Date: 2003-05-11 14:30
Logged In: YES 
user_id=2772

I don't believe that the naming convention of cloned menus is actually documented anywhere (it's certainly not documented in menu(n) of tk-8.3.5 as packaged by RedHat.  The only promise that the documentation makes is that the clone "is a child of the original". (but that can be violated if "menu clone" is invoked directly:

% menu .m
.m
% .m clone .n
%
)

That said, the convention for automatically generated clones hasn't varied in the versions of Tk I'm aware of (at least 8.2 through 8.4) so it might be reasonable to depend on this.

Does anybody in Python development also keep up with Tcl/Tk development?  It might be reasonable to ask them to document the format of automatically generated clone names.
msg78634 - (view) Author: Guilherme Polo (gpolo) Date: 2008-12-31 17:04
Eh.. old.
Anyway, I have made a patch against trunk now and it should work with
any nested level of cloned menus according to how tk names cloned menus.
History
Date User Action Args
2008-12-31 17:04:34gpolosetfiles: + nametowidget_clonedmenus.diff
nosy: + gpolo
messages: + msg78634
versions: + Python 2.6, Python 3.0, Python 3.1, Python 2.7, - Python 2.3
2003-05-07 20:11:52gregcouchcreate