This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tkinter Scale returns only integer from/to values
Type: Stage:
Components: Tkinter Versions: Python 2.4
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: loewis Nosy List: loewis, tom_goddard
Priority: normal Keywords:

Created on 2005-09-23 01:45 by tom_goddard, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (1)
msg26369 - (view) Author: Tom Goddard (tom_goddard) Date: 2005-09-23 01:45
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)
History
Date User Action Args
2022-04-11 14:56:13adminsetgithub: 42405
2005-09-23 01:45:23tom_goddardcreate