How do I install correctly with Python Tkinter?
I'm using Geany to learn to program in Python, I'm trying to start work the following code:
Code: Select all
from Tkinter import *
def Cumprimente():
hello.set("Hello World")
gui = tk()
gui.title("Python3 + tkinter")
gui.geometry("400x300")
btn = Button(gui, text="Cumprimente", Command=Cumprimente)
btn.pack()
hello = StringVar()
lbl = Label(gui, TextVariable=hello)
lbl.pack()
gui.mainloop()
Code: Select all
Traceback (most recent call last):
File "Hello World.py", line 7, in <module>
gui = tk()
NameError: name 'tk' is not defined
------------------
(program exited with code: 1)
Press return to continue
How can I solve this?