Skip to content

Commit

Permalink
[FIX] Process GUI / tk coding only if running in GUI mode (#73)
Browse files Browse the repository at this point in the history
- moves tk coding, so that it is not processed during CLI mode.

* do GUI-initialization only in GUI mode

relates to #72

* move GUI-initialization to build_gui and call in start_gui function

relates to #72

* move object-initialization down again
  • Loading branch information
treee111 authored Nov 15, 2021
1 parent 2a64a17 commit 3c5cbe3
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions common_python/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,35 @@ class Input(tk.Tk):
"""

def __init__(self, *args, **kwargs):
if 'microsoft' in uname().release:
self.gui_mode = False
return

if len(sys.argv) == 1:
self.gui_mode = True

tk.Tk.__init__(self, *args, **kwargs)
else:
self.gui_mode = False

self.o_input_data = InputData()

if 'microsoft' in uname().release:
self.gui_mode = False
return
def start_gui(self):
"""
start GUI
"""
self.build_gui()

tk.Tk.__init__(self, *args, **kwargs)
# start GUI
self.mainloop()

return self.o_input_data

def build_gui(self):
"""
builds GUI consisting of several parts
"""
# build GUI
# self.geometry("420x360")
self.title("Wahoo map creator")
self.configure(bg="white")
Expand All @@ -82,15 +98,6 @@ def __init__(self, *args, **kwargs):
self.four = Buttons(container, controller=self)
self.four.pack(side=tk.TOP, fill=tk.X)

def start_gui(self):
"""
start GUI
"""
# start GUI
self.mainloop()

return self.o_input_data

def handle_create_map(self, event):
"""
run when Button "Create" is pressed
Expand Down

0 comments on commit 3c5cbe3

Please sign in to comment.