Tkinter Scrollbar get method

Lee Harr missive at frontiernet.net
Wed Jul 4 11:10:34 EDT 2001


Hi:

I am trying to use the Tkinter Scrollbar class.
The docs say that the get() method returns a
two element tuple of values between 0.0 and 1.0

What I am getting, though is a 4 element tuple:

Python 2.1 (#1, Jun 24 2001, 00:39:38)
[GCC 2.95.3 [FreeBSD] 20010315 (release)] on freebsd4
Type "copyright", "credits" or "license" for more information.
>>> import Tkinter      
>>> sb = Tkinter.Scrollbar()                  
>>> g = sb.get()
>>> print g
(0.0, 0.0, 0.0, 0.0)
>>> print sb.get.__doc__
Return the current fractional values (upper and lower end)
        of the slider position.
>>> a, b, c, d = g
>>> a, b, c, d    
(0.0, 0.0, 0.0, 0.0)
>>>


Also, when I try to do something similar to this in a
script, I get an error:

ValueError: unpack tuple of wrong size


I get this when I use either two or four elements
in the left-hand side. (or 3 or 5... I can get it
in to a single variable, and print it out -- it
looks like g above -- but am unable to unpack it.

Anyone see something I am missing here?





More information about the Python-list mailing list