Added support for floating point resolution to Scale.get().

This commit is contained in:
Guido van Rossum 1996-10-23 14:16:28 +00:00
parent db2318580a
commit 149574767c
2 changed files with 10 additions and 2 deletions

View File

@ -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)

View File

@ -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)