def __init__(selfparent=none**options)frame __init__(selfparent**optionsself pack(label(selftext="scale demos"pack(self var intvar(scale(selflabel='pick demo number'command=self onmovecatch moves variable=self varreflects position from_= to=len(demos)- pack(scale(selflabel='pick demo number'command=self onmovecatch moves variable=self varreflects position from_= to=len(demos)- length= tickinterval= showvalue=yesorient='horizontal'pack(quitter(selfpack(side=rightbutton(selftext="run demo"command=self onrunpack(side=leftbutton(selftext="state"command=self reportpack(side=rightdef onmove(selfvalue)print('in onmove'valuedef onrun(self)pos self var get(print('you picked'posdemo list(demos values())[posprint(demo()map from position to value ( viewor demoslist(demos keys())[pos](def report(self)print(self var get()if __name__ ='__main__'print(list(demos keys())demo(mainloop(besides value access and callback registrationscales have options tailored to the notion of range of selectable valuesmost of which are demonstrated in this example' codethe label option provides text that appears along with the scalelength specifies an initial size in pixelsand orient specifies an axis the from_ and to options set the scale range' minimum and maximum values (note that from is python reserved wordbut from_ is notthe tickinterval option sets the number of units between marks drawn at regular intervals next to the scale (the default means no marks are drawnthe resolution option provides the number of units that the scale' value jumps on each drag or left mouse click event (defaults to the showvalue option can be used to show or hide the scale' current value next to its slider bar (the default showvalue=yes means it is drawn tkinter tourpart