object get method returns as string for stringvaran integer for intvarand floatingpoint number for doublevar of coursewe've already seen that it' easy to set and fetch text in entry fields directlywithout adding extra code to use variables sowhy the bother about variable objectsfor one thingit clears up that nasty fetch-after-destroy peril we met in the prior section because stringvars live on after the entry widgets they are tied to have been destroyedit' ok to fetch input values from them long after modal dialog has been dismissedas shown in example - example - pp \gui\tour\entry -modal py can fetch values after destroy with stringvars from tkinter import from entry import makeformfetchfields def show(variablespopup)popup destroy(fetch(variablesorder doesn' matter here variables live on after window destroyed def ask()popup toplevel(show form in modal dialog window vars makeform(popupfieldsbutton(popuptext='ok'command=(lambdashow(varspopup))pack(popup grab_set(popup focus_set(popup wait_window(wait for destroy here root tk(button(roottext='dialog'command=askpack(root mainloop(this version is the same as the original (shown in example - and figure - )but show now destroys the pop up before inputs are fetched through stringvars in the list created by makeform in other wordsvariables are bit more robust in some contexts because they are not part of real display tree for examplethey are also commonly associated with check buttonsradio boxesand scales in order to provide access to current settings and link multiple widgets together almost coincidentallythat' the topic of the next section historic anecdotein now-defunct tkinter release shipped with python you could also set and fetch variable values by calling them like functionswith and without an argument ( var(valueand var()todayyou call variable set and get methods instead for unknown reasonsthe function call form stopped working years agobut you may still see it in older python code (and in first editions of at least one 'reilly python bookif fix made in the name of aesthetics breaks working codeis it really fix tkinter tourpart