Sorade
Sorade

Reputation: 937

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.

Upvotes: 0

Views: 2100

Answers (1)

Emmanu
Emmanu

Reputation: 797

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.

Upvotes: 5

Related Questions