Hi,
Thus spoketh "Martin B." <[email protected]>
unto us on Mon, 17 Jan 2011 17:36:52 +0100:
(...)
>
> but if i make checkbutton active, slider is disabled :(
> how i make Scale state enabled and disabled if
> self.slider.config(state=NORMAL) is unknown option.
if you're familiar with Tkinter states, the handling of states in ttk may
seem a bit odd. To set a widget to "normal" state you must not
define the state "normal" but instead turn off the "disabled" state by
prefixing the state name with an exclamation mark. Here's a minimal
example how this can be done:
#############################################################
import Tkinter
import ttk
root = Tkinter.Tk()
s = ttk.Scale(root)
s.pack(side='right', fill='x')
var = Tkinter.StringVar()
var.set('!disabled')
def callback():
s.state((var.get(),))
button = ttk.Checkbutton(root, text='foo', variable=var,
onvalue='disabled', offvalue='!disabled', command=callback)
button.pack(side='left', padx=40, pady=100)
root.mainloop()
#############################################################
I hope this helps
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
"What terrible way to die."
"There are no good ways."
-- Sulu and Kirk, "That Which Survives", stardate unknown
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss