From 149574767c2125159e06d9c9ca381c0eb6f05ea7 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 23 Oct 1996 14:16:28 +0000 Subject: Added support for floating point resolution to Scale.get(). --- Lib/lib-tk/Tkinter.py | 6 +++++- Lib/tkinter/Tkinter.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 2b1f066..a8936b5 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -1369,7 +1369,11 @@ class Scale(Widget): def __init__(self, master=None, cnf={}, **kw): Widget.__init__(self, master, 'scale', cnf, kw) def get(self): - return self.tk.getint(self.tk.call(self._w, 'get')) + value = self.tk.call(self._w, 'get') + try: + return self.tk.getint(value) + except TclError: + return self.tk.getdouble(value) def set(self, value): self.tk.call(self._w, 'set', value) diff --git a/Lib/tkinter/Tkinter.py b/Lib/tkinter/Tkinter.py index 2b1f066..a8936b5 100755 --- a/Lib/tkinter/Tkinter.py +++ b/Lib/tkinter/Tkinter.py @@ -1369,7 +1369,11 @@ class Scale(Widget): def __init__(self, master=None, cnf={}, **kw): Widget.__init__(self, master, 'scale', cnf, kw) def get(self): - return self.tk.getint(self.tk.call(self._w, 'get')) + value = self.tk.call(self._w, 'get') + try: + return self.tk.getint(value) + except TclError: + return self.tk.getdouble(value) def set(self, value): self.tk.call(self._w, 'set', value) -- cgit v0.12