pythontkinterwidgettkinter-scale

How to set the state of a tkinter Scale widget to disabled?


I have been looking around for a way to disable the Scale widget of tkinter but I couldn't find one.

I tried a few things but none seem to work:

w = Scale(master, from_=0, to=100)
w.pack()
w.state(statespec=DISABLED)
w.config(state=DISABLED)
w.config(state='disabled')
w.configure(state='disabled')

Does anyone know if it possible or if there is a workaround ? I managed to get it to work fine for Button and Checkbutton widgets.


Solution

  • w.config(state=DISABLED,takefocus=0)
    

    will make scale widget disabled.It nolonger move

    from Tkinter import *
    
    master=Tk()
    w = Scale(master, from_=1, to=10)
    w.config(state=DISABLED,takefocus=0)
    w.pack()
    
    master.mainloop()
    

    Its works perfect for me.