tkinter - Python: is there a way to have default for Entry field? -
is there way have text box in gui have default text display?
i want text box have "please set path of file want..." however, when run - blank...
my code follows:
path=stringvar() textentry=entry(master,textvariable=path,text='please set path of file want...') textentry.pack()
this should demonstrate how want:
import tkinter tk root = tk.tk() entry = tk.entry(root, width=40) entry.pack() # put text in entrybox insert method. # 0 means "at begining". entry.insert(0, 'please set path of file want...') text = tk.text(root, width=45, height=5) text.pack() # textboxes have insert. # however, since have height , width, need # put 0.0 spcify beginning. same # x=0, y=0. text.insert(0.0, 'please set path of file want...') root.mainloop()
Comments
Post a Comment