tkinter - Python - AttributeError: 'str' object has no attribute 'items' -


i'm beginner in tkinter. i'm trying make phone book gui application.

so, i'm in beginning step, here source code:

#this python 'source.py' learning purpose  tkinter import tk tkinter import button tkinter import left tkinter import label tkinter import frame tkinter import pack  wn = tk() f = frame(wn)  b1 = button(f, "one") b2 = button(f, "two") b3 = button(f, "three")  b1.pack(side=left) b2.pack(side=left) b3.pack(side=left)  l = label(wn, "this label!")  l.pack() l.pack()  wn.mainloop() 

as run, program gives following error:

/usr/bin/python3.4 /home/rajendra/pycharmprojects/pythonproject01/mypackage/source.py traceback (most recent call last):   file "/home/rajendra/pycharmprojects/pythonproject01/mypackage/source.py", line 13, in <module>     b1 = button(f, "one")   file "/usr/lib/python3.4/tkinter/__init__.py", line 2164, in __init__     widget.__init__(self, master, 'button', cnf, kw)   file "/usr/lib/python3.4/tkinter/__init__.py", line 2090, in __init__     classes = [(k, v) k, v in cnf.items() if isinstance(k, type)] attributeerror: 'str' object has no attribute 'items'  process finished exit code 1 

can please let me know what's wrong here?

help appreciated!

you need tkinter, "one", "two" etc.. for.

button(f, text="one") label(wn, text="this label!") 

to answer why need that, should check how functions , arguments work in python.

also, might want pack frame since buttons on , can use "left" instead of tkinter.left


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -