diff options
author | Guido van Rossum <guido@python.org> | 1996-10-23 14:16:28 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-10-23 14:16:28 (GMT) |
commit | 149574767c2125159e06d9c9ca381c0eb6f05ea7 (patch) | |
tree | def1cea8f390981f87a723e9ef33349a51169c15 /Lib | |
parent | db2318580a88e5b4b6c1bf0a77743a626c402d62 (diff) | |
download | cpython-149574767c2125159e06d9c9ca381c0eb6f05ea7.zip cpython-149574767c2125159e06d9c9ca381c0eb6f05ea7.tar.gz cpython-149574767c2125159e06d9c9ca381c0eb6f05ea7.tar.bz2 |
Added support for floating point resolution to Scale.get().
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 6 | ||||
-rwxr-xr-x | 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) |