Set tkinter Entry default value Set tkinter Entry default value tkinter tkinter

Set tkinter Entry default value


ttk widgets are more sensitive to garbage collection than tkinter widgets. Your variables (which you don't actually need) are local variables, so they are getting garbage collected.

The reason that it works in the other code is that the askdirectory function is inside the create_askdirectory function so it is able to see the local variables.

My advice is to not use StringVar -- in this case they are completely unnecessary.

box = ttk.Entry(self.mainframe)box.insert(0, arg.get("default", ""))