I was wondering why tkinter won't let me use its StringVar()
function.
Relevant part of my code:
import tkinter as tk, os
font = ("Curlz MT", 14, "bold")
font2 = ("Curlz MT", 10, "bold")
GameName = tk.StringVar()
root = tk.Tk()
root.geometry('240x50+0+0')
root.title("Name?")
EyourName = tk.Entry(font=font, width=16, textvariable=GameName)
EyourName.insert(tk.END, "Waiting...")
EyourName.place(x=8,y=8)
Bok = tk.Button(font=font2, width=2, text="Ok", command=Ok)
Bok.place(x=200, y=8)
root.mainloop()
(full program here: http://www.2shared.com/file/nANE4rSD/Blah_Blah_Blah.html)
Error:
Traceback (most recent call last):
File "C:\Documents and Settings\SOMENAME\Desktop\David\Python\MonstaWorld\NewGame2.py",
line 34, in <module>
GameName = tk.StringVar()
File "C:\Python32\lib\tkinter\__init__.py", line 243, in __init__
Variable.__init__(self, master, value, name)
File "C:\Python32\lib\tkinter\__init__.py", line 174, in __init__
self._tk = master.tk
AttributeError: 'NoneType' object has no attribute 'tk'