Coupled variables in Tkinter???

Jørgen Cederberg jorgencederberg at hotmail.com
Thu Feb 20 04:10:12 EST 2003


Maurice wrote:
> Dear all,
> 
> I want implement a GUI in which I've four sliders using Tkinter.
> To do this I've put all the stuff in a class:
>  
> class SliderAndAxesWidget:
>     def __init__(self,master):
> 
>         self.Slider1Value=IntVar()
>          self.Slider2Value=IntVar()
>         self.Slider3Value=IntVar()
>         self.Slider4Value=IntVar()
>        
>         self.Slider1Value=0
>         self.Slider2Value=0
>         self.Slider3Value=0
>         self.Slider4Value=0
>        

Hi,

You should use the set and get methods for the the IntVar:
self.Slider1Value.set(0)
val = self.Slider1Value.get()

See 
http://www.pythonware.com/library/tkinter/introduction/x5195-methods.htm 
for more info.

Regards
Jorgen Cederberg





More information about the Python-list mailing list