diff options
author | emkael <emkael@tlen.pl> | 2015-10-27 15:37:36 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2015-10-27 16:54:51 +0100 |
commit | 6efb145e8a902f7eec295ec524bdece01d83528d (patch) | |
tree | 482ae18f709e0a2929492a91bdc6aec324c9f934 | |
parent | 4bcf8fb8214c3f2e71ea5dc6ef2d73d16cfa716c (diff) |
* asynchronous action dispatch
-rw-r--r-- | src/bidding_data_gui.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/bidding_data_gui.py b/src/bidding_data_gui.py index ebc789c..4986216 100644 --- a/src/bidding_data_gui.py +++ b/src/bidding_data_gui.py @@ -32,6 +32,7 @@ class BiddingGUI(tk.Frame): Sanitizes input parameters, handles warning/error messages, imports main module (from CLI script) and runs it. """ + self.run_btn['state'] = tk.DISABLED try: # reset error/warning count and log output field self.__gui_logger.reset_counts() @@ -71,6 +72,8 @@ class BiddingGUI(tk.Frame): log.getLogger('root').error(ex) tkMessageBox.showerror('Błąd!', ex) raise + finally: + self.run_btn['state'] = tk.NORMAL def tour_select(self): """ @@ -134,6 +137,10 @@ class BiddingGUI(tk.Frame): # the wm.iconphoto call self.master.tk.call('wm', 'iconphoto', self.master._w, img) + def __dispatch_run_button_action(self): + """Dispatch main button action asynchronously.""" + self.run_btn.after(0, self.run_bidding_data) + def __create_widgets(self): """ Create main application window controls and align them on grid. @@ -169,13 +176,14 @@ class BiddingGUI(tk.Frame): bws_select_btn.grid(row=1, column=5) # main command button - run_btn = tk.Button( - self, text='No to sru!', height=3, command=self.run_bidding_data) + self.run_btn = tk.Button( + self, text='No to sru!', height=3, + command=self.__dispatch_run_button_action) # application exit button quit_btn = tk.Button( self, text='Koniec tego dobrego', command=self.quit) # third row, leftmost 2/3 of window width, fills entire cell - run_btn.grid( + self.run_btn.grid( row=2, column=0, columnspan=4, sticky=tk.N+tk.S+tk.E+tk.W) # third row, rightmost 1/3 of window width quit_btn.grid(row=2, column=4, columnspan=2) |