Oct-12-2019, 03:50 PM
Hi
please someone can tell me why this code works
please someone can tell me why this code works
from tkinter import *
root=Tk()
root.title("teste ao programa")
#root.configure(background="black")
lopes=Entry(root,fg="red")
lopes.pack()
lopes.focus_set()
def ola():
print(lopes.get())
lopes.delete(0,END)
b=Button(root,text="OK",width=6,command=ola)
b.pack()
mainloop()and this code does not workfrom tkinter import *
root=Tk()
root.title("teste ao programa")
#root.configure(background="black")
lopes=Entry(root,fg="red").grid(row=1,column=1)
#lopes.pack()
lopes.focus_set()
def ola():
print(lopes.get())
lopes.delete(0,END)
b=Button(root,text="OK",width=6,command=ola).grid(row=1,column=0,sticky=W)
#b.pack()
mainloop()Thnak you
