From 2cf0a91a69e383fe4f08893a0d44a21569b6334e Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 13 Dec 2017 23:50:22 +0100 Subject: Not clearing file paths on file dialog cancel --- src/bidding_data_gui.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/bidding_data_gui.py b/src/bidding_data_gui.py index f770003..b9a3a34 100644 --- a/src/bidding_data_gui.py +++ b/src/bidding_data_gui.py @@ -121,9 +121,11 @@ class BiddingGUI(tk.Frame): Displays file selection dialog for tournament file and stores user's choice in Tk variable. """ - self.__variables['tour_filename'].set(tkFileDialog.askopenfilename( + filename = tkFileDialog.askopenfilename( title='Wybierz główny plik wyników turnieju', - filetypes=[('HTML files', '.htm*'), ('all files', '.*')])) + filetypes=[('HTML files', '.htm*'), ('all files', '.*')]) + if filename is not None and len(filename) > 0: + self.__variables['tour_filename'].set(filename) def bws_select(self): """ @@ -133,9 +135,11 @@ class BiddingGUI(tk.Frame): Displays file selection dialog for tournament file and stores user's choice in Tk variable. """ - self.__variables['bws_filename'].set(tkFileDialog.askopenfilename( + filename = tkFileDialog.askopenfilename( title='Wybierz plik z danymi licytacji', - filetypes=[('BWS files', '.bws'), ('all files', '.*')])) + filetypes=[('BWS files', '.bws'), ('all files', '.*')]) + if filename is not None and len(filename) > 0: + self.__variables['bws_filename'].set(filename) def display_info(self): """Show application "About" box.""" -- cgit v1.2.3