What are the errors in a simpliest Tix application?

  • Thread starter =?windows-1251?b?xeLj5e3o6SDK7vHl7eru?=
  • Start date
?

=?windows-1251?b?xeLj5e3o6SDK7vHl7eru?=

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
 
K

klappnase

??????? ??????? said:
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 "-"
Does the manual say so? I never heard about this, I always use something like:

import Tkinter
import Tix

root = Tix.Tk()
button = Tkinter.Button(root)
etc...

This way I never had problems.

Cheers

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top