def initialize(): app = QtWidgets.QApplication(sys.argv) w = MainMenu() w.run_widget.hooah.clicked.connect(lambda: run(w)) w.show() sys.exit(app.exec_())
class OCRApp(App): def __init__(self, **kwargs): super(OCRApp, self).__init__(**kwargs) self.main_menu = MainMenu(name='menu') self.results = Results(name='results') self.main_menu.bind(on_ocr_run=self.append_images) def build(self): self.root = ScreenManager() self.root.add_widget(self.main_menu) self.root.add_widget(self.results) return self.root def append_images(self, instance, images, api_key): self.results.api_key = api_key self.results.image_filenames = images
def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) self.school_db = SchoolDB(SchoolInitializer()) Tk.wm_title(self, 'Contoso University') self.menubar = MainMenu(self) self.config(menu=self.menubar) self.frames = {} self.__init_frames()
def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) Tk.wm_title(self, 'Contoso University') self.menubar = MainMenu(self) self.config(menu=self.menubar) self.frames = {} self.__init_frames()
def main(argv): script = None # Parse command line inputs try: opts, args = getopt(argv, "hs:", ["script=", "help"]) except GetoptError: print_help() sys.exit(2) for opt, arg, in opts: if opt in ["-h", "--help"]: print_help() sys.exit() elif opt in ["-s", "--script"]: if arg in SCRIPT_DICT: script = SCRIPT_DICT[arg] else: print_help() sys.exit() # If a script is specified on the command line - run it! if script: script() return # Search for application data directory, if running as executable data_dir = None if is_frozen(): data_dir = user_data_dir('LSJUMB Librarianz Scripts', 'LSJUMB', VERSION) res_options = parse_options("res_paths.json", from_=data_dir) res_options['res-path'] = data_dir make_application_data(data_dir, VERSION != res_options.get('version')) res_options['version'] = VERSION write_options(res_options, "res_paths.json") write_options(res_options, "res_paths.json") # Run Main Application root = tk.Tk() MainMenu(root, data_dir) root.mainloop()
def gotoScreen(self, screenType, params = None): if self.m_currentScreen != None: self.m_currentScreen.free() self.m_currentScreen = None if screenType == ScreenType.MAIN_MENU: self.m_currentScreen = MainMenu(self.m_width, self.m_height, colors.GRAY) elif screenType == ScreenType.META_MAP: self.m_currentScreen = Metamap(self.m_width, self.m_height, colors.GRAY) elif screenType == ScreenType.META_MAP_DEMOS: self.m_currentScreen = MetamapDemos(self.m_width, self.m_height, colors.GRAY) elif screenType == ScreenType.META_MAP_SIMULATIONS: self.m_currentScreen = MetamapSimulation(self.m_width, self.m_height, colors.GRAY) elif screenType == ScreenType.META_MAP_TRAININGS: self.m_currentScreen = MetamapTraining(self.m_width, self.m_height, colors.GRAY) elif screenType == ScreenType.SETTINGS: self.m_currentScreen = SettingsScreen(self.m_width, self.m_height, colors.GRAY) elif screenType == ScreenType.SIMULATION: self.createSimulationScreen(params) else: return self.m_currentScreenType = screenType self.m_currentScreen.setManager(self)
def __init__(self, **kwargs): super(OCRApp, self).__init__(**kwargs) self.main_menu = MainMenu(name='menu') self.results = Results(name='results') self.main_menu.bind(on_ocr_run=self.append_images)