In Tkinter - having an input and an entry

markfernandes02 at googlemail.com markfernandes02 at googlemail.com
Sat Apr 5 13:49:37 CEST 2008


Traceback (most recent call last):
  File "F:\Programming\python and database\access_db8.2.py", line 129,
in ?
    Tkwindow()
  File "F:\Programming\python and database\access_db8.2.py", line 88,
in Tkwindow
    title = stringVar()
NameError: global name 'stringVar' is not defined

Here is the TKwindow code.

def Tkwindow():
    global entry, entry2, entry3, entry4, entry5, entry6
    global title, author, pubdate
    root = Tk()
    b1 = Button(root, text='Exit', command=root.quit)
    b1.grid(column = 1, row = 4)
    b2 = Button(root, text= 'Fetch', command= Fetch)
    b2.grid(column = 0, row = 3)
    b3 = Button(root, text= 'Clear', command= Clear)
    b3.grid(column = 0, row = 4)
    b4 = Button(root, text= 'Insert', command= Insert)
    b4.grid(column = 1, row = 3)

    #title = stringVar()
    #author = stringVar()
    #pubdate = stringVar()

    entry = Entry(root)
    entry.grid(column = 0, row = 0)
    entry2 = Entry(root)
    entry2.grid(column = 0, row = 1)
    entry3 = Entry(root)
    entry3.grid(column = 0, row = 2)

    title = stringVar()
    entry4 = Entry(root, textvariable = title)
    entry4.grid(column = 1, row = 0)

    author = stringVar()
    entry5 = Entry(root, textvariable = author)
    entry5.grid(column = 1, row = 1)

    pubdate = stringVar()
    entry6 = Entry(root, textvariable = pubdate)
    entry6.grid(column = 1, row = 2)

    print author
    print title
    print pubdate

    root.mainloop()



More information about the Python-list mailing list