Mailing List Archive

Tkinter slide question
I'm trying to implement a slide to control how often a function restarts
but it appears that I'm not getting the result back from the 'variable'
variable. Could some kind soul out there on the proper way to read the
slide 'position'?

Code snipit:
Scale(label="Rescan",variable=self.yspeed,orient=HORIZONTAL,).grid(column=0)

currently returns PY_VAR12 instead of the slider value.


Thanks!
Tkinter slide question [ In reply to ]
David Stokes wrote:
>
> I'm trying to implement a slide to control how often a function restarts
> but it appears that I'm not getting the result back from the 'variable'
> variable. Could some kind soul out there on the proper way to read the
> slide 'position'?
>
> Code snipit:
> Scale(label="Rescan",variable=self.yspeed,orient=HORIZONTAL,).grid(column=0)
>
> currently returns PY_VAR12 instead of the slider value.

Try
self.yspeed.get()
to get the value of the variable.

--
Dr. Gary Herron <gherron@aw.sgi.com>
206-287-5616
Alias | Wavefront
1218 3rd Ave, Suite 800, Seattle WA 98101
Tkinter slide question [ In reply to ]
David Stokes writes:
> Code snipit:
> Scale(label="Rescan",variable=self.yspeed,orient=HORIZONTAL,).grid(column=0)
>
> currently returns PY_VAR12 instead of the slider value.

David,
Appearantly, you're refering to self.yspeed to get the value of the
variable, although you seem to have initialized self.yspeed with an
instance of Tkinter.StringVar or one of it's friends.
To get the value, use self.yspeed.get(); the object itself is simply
a reference to a Tcl variable. The get() method will return the value
as the data type indicated by the name of the class you instantiated
to create self.yspeed.


-Fred

--
Fred L. Drake, Jr. <fdrake@acm.org>
Corporation for National Research Initiatives
Tkinter slide question [ In reply to ]
From: "Fred L. Drake" <fdrake@cnri.reston.va.us>


David Stokes writes:
> Code snipit:
> Scale(label="Rescan",variable=self.yspeed,orient=HORIZONTAL,).grid(column=0)
>
> currently returns PY_VAR12 instead of the slider value.

David,
Appearantly, you're refering to self.yspeed to get the value of the
variable, although you seem to have initialized self.yspeed with an
instance of Tkinter.StringVar or one of it's friends.
To get the value, use self.yspeed.get(); the object itself is simply
a reference to a Tcl variable. The get() method will return the value
as the data type indicated by the name of the class you instantiated
to create self.yspeed.


-Fred

--
Fred L. Drake, Jr. <fdrake@acm.org>
Corporation for National Research Initiatives