Reputation: 19
I have tried all the hello world for tkinter and python 3.5 on my PC 64 bit Windows 8 but it doesn't work...
from tkinter import *
class Application(Frame):
def __init__(self,master=None):
Frame.__init__(self,master)
self.grid()
self.create_widgets()
def create_widgets(self):
self.myButton = Button(self, text='Button Label')
self.myButton.grid()
root = Tkinter.Tk()
root.title('Frame w/ Button')
root.geometry('200x200')
app = Application(root)
root.mainloop()
This code gives me the error NameError: name 'Tk' is not defined
I am grateful for any help, Alain
Upvotes: 0
Views: 1424
Reputation: 3691
If you look at your code you write
from tkinter import *
Then you use
root = Tkinter.Tk()
Why didn't you try
root = Tk()
?
Because you are importint everything from tkinter
you do not need to use the module to access Tk()
. And you have a typo too in your mentioned line: the module's name starts with a lowercase t
.
Upvotes: 3