[ python-Bugs-1299520 ] Tkinter Scale returns only integer from/to values

SourceForge.net noreply at sourceforge.net
Fri Sep 23 04:20:23 CEST 2005


Bugs item #1299520, was opened at 2005-09-22 18:45
Message generated for change (Settings changed) made by tom_goddard
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1299520&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
Group: Python 2.4
>Status: Deleted
Resolution: None
Priority: 5
Submitted By: Tom Goddard (tom_goddard)
Assigned to: Martin v. Löwis (loewis)
Summary: Tkinter Scale returns only integer from/to values

Initial Comment:
Tk "scale" widgets allow floating point range values.
But Tkinter.Scale returns integer values for 'from' and
'to' attributes even when they were set to non-integer
values.

>>> s = Tkinter.Scale()
>>> s['from'] = 1.23
>>> s['from']
1.0

The problem is in the Tkinter.Scale.get method.  It
converts the floating point value to an integer.

>From Tkinter.py:

getint = int
class Scale(Widget):
    def get(self):
        """Get the current value as integer or float."""
        value = self.tk.call(self._w, 'get')
        try:
            return getint(value)
        except ValueError:
            return getdouble(value)
    def set(self, value):
        """Set the value to VALUE."""
        self.tk.call(self._w, 'set', value)


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1299520&group_id=5470


More information about the Python-bugs-list mailing list