summaryrefslogtreecommitdiff
path: root/jfr_playoff/gui/variables.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-07-07 21:24:44 +0200
committeremkael <emkael@tlen.pl>2019-07-07 21:24:44 +0200
commit1059281a8962dd7529318b529aeda02ca8544722 (patch)
treeb7f729d69e3212151b8859b5e5c31ade9e5129b1 /jfr_playoff/gui/variables.py
parent4f55701e1b291a9a6da9eb7aef5802e6bc20cbf0 (diff)
Tracing dirty state of edited file
Diffstat (limited to 'jfr_playoff/gui/variables.py')
-rw-r--r--jfr_playoff/gui/variables.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/jfr_playoff/gui/variables.py b/jfr_playoff/gui/variables.py
index abb3cc1..8927179 100644
--- a/jfr_playoff/gui/variables.py
+++ b/jfr_playoff/gui/variables.py
@@ -5,10 +5,13 @@ import tkinter as tk
class NotifyVar(tk.Variable):
def __init__(self, *args, **kwargs):
tk.Variable.__init__(self, *args, **kwargs)
- self.trace('w', self._onChange)
+ self._prevValue = self.get()
+ self._root.after(0, self.trace, 'w', self._onChange)
def _onChange(self, *args):
- self._root.event_generate('<<ValueChanged>>', when='tail')
+ if self._prevValue != self.get():
+ self._root.event_generate('<<ValueChanged>>', when='tail')
+ self._prevValue = self.get()
class NotifyStringVar(NotifyVar, tk.StringVar):
pass