What are the errors in a simpliest Tix application?

Евгений Косенко eugine_kosenko at ukr.net
Tue Dec 9 17:11:31 EST 2003


Hi!

I make my first steps in Tkinter/Tix programming. The next program is work 
well (really, _almost_ well):

import Tkinter

root = Tkinter.Tk()
widget = Tkinter.Button(root)

Really, this is not an application, it is only the minimal non-problematic 
piece of application code.

As the Python Library manual says, the only thing I need to use Tix is to 
replace Tkinter in the last program to Tk:

import Tix

root = Tix.Tk()
widget = Tix.Button(root)

However, I have got the next exception tracelist:

Traceback (most recent call last):
  File "tix.py", line 4, in ?
    widget = Tix.Button(root)
  File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1906, in __init__
    Widget.__init__(self, master, 'button', cnf, kw)
  File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1835, in __init__
    self.tk.call(
_tkinter.TclError: expected integer but got "-"

I'm sure that the Tix platform -- I saw demos succesfully. It seems like an 
error inside the Tix package. Maybe, something wrong in my code pattern, but 
I may not understand, where is my mistake. Who can help me?

When I use an integer parameter in the program:

widget = Tix.Button(root, 10)

the exception tracelist is different:

Traceback (most recent call last):
  File "tix.py", line 4, in ?
    widget = Tix.Button(root, 10)
  File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1906, in __init__
    Widget.__init__(self, master, 'button', cnf, kw)
  File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1829, in __init__
    BaseWidget._setup(self, master, cnf)
  File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1809, in _setup
    if cnf.has_key('name'):
AttributeError: 'int' object has no attribute 'has_key'

Originally, I need the ComboBox widget from Tix, and for it I got the next 
tracelist:

Traceback (most recent call last):
  File "tix.py", line 4, in ?
    widget = Tix.ComboBox(root, 10)
  File "/usr/lib/python2.3/lib-tk/Tix.py", line 576, in __init__
    cnf, kw)
  File "/usr/lib/python2.3/lib-tk/Tix.py", line 284, in __init__
    cnf = _cnfmerge(cnf)
  File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 85, in _cnfmerge
    for c in _flatten(cnfs):
TypeError: len() of unsized object







More information about the Python-list mailing list