Tkinter error

B

BartlebyScrivener

Finally started trying to build a simple gui form for inserting text
data into a mysql db of quotations.

I found this nice Tkinter tutorial,

http://www.ibiblio.org/obp/py4fun/gui/tkPhone.html

but midway I'm getting an error.

from Tkinter import *

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1936, in __init__
Widget.__init__(self, master, 'button', cnf, kw)
File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1859, in __init__
BaseWidget._setup(self, master, cnf)
File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1839, in _setup
if cnf.has_key('name'):
AttributeError: 'str' object has no attribute 'has_key'
 
P

Peter Otten

BartlebyScrivener said:
Finally started trying to build a simple gui form for inserting text
data into a mysql db of quotations.

I found this nice Tkinter tutorial,

http://www.ibiblio.org/obp/py4fun/gui/tkPhone.html

but midway I'm getting an error.

from Tkinter import *


Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1936, in __init__
Widget.__init__(self, master, 'button', cnf, kw)
File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1859, in __init__
BaseWidget._setup(self, master, cnf)
File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1839, in _setup
if cnf.has_key('name'):
AttributeError: 'str' object has no attribute 'has_key'

Hmm, there must have been an update to that tutorial after you read it:

"""

The class Button takes the parent window as the first argument. As we will
see later other objects, such as frames, may also act as parents. The rest
of the arguments are passed by keyword and are all optional.
"""

Peter
 

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,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top