Пример #1
0
 def __init__(self):
     """
     Main Gui Entrance
     """
     tkinter.Tk.report_callback_exception = self.throw
     # Main window
     self.destroyed = False
     LoggerGui.info("Initializing GUI")
     self.main_window = tkinter.Tk()
     self.main_window.wm_title("DRC Sim Server")
     icon = tkinter.PhotoImage(data=Resource("image/icon.gif").resource)
     self.main_window.tk.call("wm", "iconphoto", self.main_window, icon)
     self.main_window.protocol("WM_DELETE_WINDOW", self.on_closing)
     self.main_window.resizable(False, False)
     # Notebook
     self.tab_id = None
     self.notebook = Notebook(self.main_window, width=600, height=300)
     self.notebook.grid(column=0, row=0)
     self.notebook.bind("<<NotebookTabChanged>>", self.on_tab_changed)
     # Run Server Frame
     self.frame_run_server = FrameRunServer(self.notebook)
     self.notebook.add(self.frame_run_server, text="Run Server")
     # Get Key Frame
     self.frame_get_key = FrameGetKey(self.notebook)
     self.notebook.add(self.frame_get_key, text="Get Key")
     # Log Frame
     self.frame_log = FrameLog(self.notebook)
     self.notebook.add(self.frame_log, text="Log")
     # About Frame
     self.frame_about = FrameAbout(self.notebook)
     self.notebook.add(self.frame_about, text="About")
Пример #2
0
 def start(self):
     """
     Start the main window loop
     :return:
     """
     LoggerGui.info("Opening GUI")
     self.after()
     self.main_window.mainloop()
     LoggerGui.info("GUI Closed")
Пример #3
0
 def on_closing(self):
     """
     Close the main window and current tab
     :return: None
     """
     if self.destroyed:
         return
     self.destroyed = True
     LoggerGui.info("Closing GUI")
     if self.tab_id in self.notebook.children:
         self.notebook.children[self.tab_id].deactivate()
     try:
         self.main_window.destroy()
     except Exception as e:
         LoggerGui.exception(e)