[ python-Bugs-1472877 ] Tix: Subwidget names

SourceForge.net noreply at sourceforge.net
Wed Apr 19 12:26:56 CEST 2006


Bugs item #1472877, was opened at 2006-04-19 10:26
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1472877&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthias Kievernagel (mkiever)
Assigned to: Martin v. Löwis (loewis)
Summary: Tix: Subwidget names

Initial Comment:
My system information:
------------------------------------------
uname -a:
Linux linux 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 
2004 i686 athlon i386 GNU/Linux
Python:
Python 2.4.1 (#4, Jan 10 2006, 10:53:14) 
[GCC 3.3.3 (SuSE Linux)] on linux2
and
Python 2.3.5 (#1, Sep 12 2005, 14:56:24) 
[GCC 3.3.3 (SuSE Linux)] on linux2
------------------------------------------

Using Tix you can produce the following exception:

---------------------------------------------------
>>> from Tix import *
>>> tk = Tk ()
>>> b = Balloon ()
>>> b.subwidget ( 'label' )
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/mkiever/pro/Python-2.4.1/Lib/lib-tk/Tix.
py", line 340, in subwidget
    return self._nametowidget(n)
  File "/home/mkiever/pro/Python-2.4.1/Lib/lib-tk/
Tkinter.py", line 1015, in nametowidget
    w = w.children[name]
KeyError: 'lab'
>>> 
---------------------------------------------------

I found a commentary in Tix.py:TixWidget:__init__
stating that 'subwidget_list' should contain
Tix names. But in Tix.py:TixSubWidget:__init__
the python names are used, not the names returned
by Tix. 

I was successful with the following two
small additions (+++) near lines 400-450:
---------------------------------------------
class TixSubWidget(TixWidget):
 ...
 def __init__(self, master, name,
              destroy_physically=1,
              check_intermediate=1):
  ...
  if (not check_intermediate) or len(plist) < 2:
   # immediate descendant
   if check_intermediate:                        +++
    name = plist [0]                             +++
   TixWidget.__init__(self, master, None, None, 
                      {'name' : name})
  else:
   ...
   name = plist [-1]                             +++
   TixWidget.__init__(self, parent, None, None,
                      {'name' : name})
  self.destroy_physically = destroy_physically
...
---------------------------------------------

This replaces the python name by the name
returned from Tix.
I have not extensively tested this (sorry).
Hope this helps.

Matthias Kievernagel  (mkiever at web.de)


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1472877&group_id=5470


More information about the Python-bugs-list mailing list