diff options
author | emkael <emkael@tlen.pl> | 2019-07-25 17:17:03 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-07-25 17:17:03 +0200 |
commit | e5620ec415e677603e0144e367dec938504c4c2d (patch) | |
tree | 5a6a1a9bdf643f85ce13b07b29873044df1c346f /jfr_playoff/gui/variables.py | |
parent | 749181b0b5c4ce554542f6c3213be31f39421240 (diff) |
NumericVar without Notify features
Diffstat (limited to 'jfr_playoff/gui/variables.py')
-rw-r--r-- | jfr_playoff/gui/variables.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/jfr_playoff/gui/variables.py b/jfr_playoff/gui/variables.py index 8927179..e6877f2 100644 --- a/jfr_playoff/gui/variables.py +++ b/jfr_playoff/gui/variables.py @@ -13,15 +13,18 @@ class NotifyVar(tk.Variable): self._root.event_generate('<<ValueChanged>>', when='tail') self._prevValue = self.get() +class NumericVar(tk.StringVar): + def get(self, default=None): + try: + return int(str(tk.StringVar.get(self)).strip()) + except ValueError: + return default + class NotifyStringVar(NotifyVar, tk.StringVar): pass class NotifyIntVar(NotifyVar, tk.IntVar): pass -class NotifyNumericVar(NotifyStringVar): - def get(self, default=None): - try: - return int(str(NotifyStringVar.get(self)).strip()) - except ValueError: - return default +class NotifyNumericVar(NotifyVar, NumericVar): + pass |