Separate the line for the grid statement and it will run the same as the other but using grid instead of the pack method..
from tkinter import * root=Tk() root.title("teste ao programa") #root.configure(background="black") lopes=Entry(root,fg="red") lopes.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()
"Often stumped... But never defeated."