This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tix: Subwidget names
Type: Stage:
Components: Tkinter Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: loewis, mkiever
Priority: normal Keywords:

Created on 2006-04-19 10:26 by mkiever, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg28305 - (view) Author: Matthias Kievernagel (mkiever) * Date: 2006-04-19 10:26
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@web.de)
msg28306 - (view) Author: Matthias Kievernagel (mkiever) * Date: 2006-10-25 20:36
Logged In: YES 
user_id=1477880

Solution was not complete.
Submitted a complete patch #1472877 for this
which is tested against the tix demo code
in Demo/tix/tixwidgets.py

Matthias Kievernagel
mkiever at web dot de

msg28307 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-11-18 18:49
Fixed with said patch.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43249
2006-04-19 10:26:56mkievercreate