I want to make a Scale and assign it's "to" attribute with 0 and "from_" attribute with a stringvar like this.
import tkinter
str=tkinter.StringVar()
gui=tkinter.Tk()
s=tkinter.Scale(gui,from_="0",to=str)
str.set("50")
I also tried this:
import tkinter
str=tkinter.doubleVar()
gui=tkinter.Tk()
s=tkinter.Scale(gui,from_=0,to=str)
str.set(50)
I am stuck at this point
You cannot do what you want. The from_
and to
options require static values.
If you want to change the to
value after creating the widget you will need to explicitly configure it (eg: s.configure(to=str.get()
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.