def make_main_window(self): main_win = Window(size=(GetSystemMetrics(0)-20, \ GetSystemMetrics(1)-10),title='Software de manejo de eventos',\ resizable=False) # Edición de los menús básicos que ofrece PyGUI menus = basic_menus(exclude = file_cmds + print_cmds) self.menus = menus # Hacer visible la ventana return main_win
def main(): view = CTV(size=(200, 300)) win = Window(title="Canvas") win.add(view) win.shrink_wrap() view.become_target() win.show() app = application() app.menus = basic_menus() + [test_menu] app.run()
def __init__(self): Application.__init__(self) self.gesture_type = FileType(name = "GestureFile", suffix = "ges", #mac_creator = "BLBE", mac_type = "BLOB", # These are optional ) self.file_type = self.gesture_type #MENUS menus = basic_menus() my_menu = Menu("Widget", [("Swizzle", 'swiz_cmd'), ("Defibrillate", 'defib_cmd')]) menus.append(my_menu) self.menus = menus
def run(self): """The main event loop. Runs until _quit() is called, or KeyboardInterrupt or SystemExit is raised.""" # Implementations may override this together with _quit() to use # a different means of causing the main event loop to exit. self.process_args(sys.argv[1:]) if self._menus is None: self.menus = basic_menus() while not self._quit_flag: try: self.event_loop() # except (KeyboardInterrupt, Quit), e: except KeyboardInterrupt: return except SystemExit: raise except: self.report_error()
def run(self): """The main event loop. Runs until _quit() is called, or KeyboardInterrupt or SystemExit is raised.""" # Implementations may override this together with _quit() to use # a different means of causing the main event loop to exit. self.process_args(sys.argv[1:]) if self._menus is None: self.menus = basic_menus() while not self._quit_flag: try: self.event_loop() #except (KeyboardInterrupt, Quit), e: except KeyboardInterrupt: return except SystemExit: raise except: self.report_error()
position = (10, 140), size = (120, 25), title = "Quit Launcher", action = self._close_cmd )) def _close_cmd(self): self._game_controller.quit() self._application.quit_cmd() def _btn_default(self): self._game_controller.launch_default() def _btn_tutorial(self): self._game_controller.launch_tutorial() def _btn_readme(self): subprocess.call(('open', '-a', 'TextEdit', 'README.md')) def _btn_licence(self): subprocess.call(('open', '-a', 'TextEdit', 'LICENCE.md')) if __name__ == '__main__': os.chdir(os.path.dirname(sys.argv[0])) app = application() app.menus = basic_menus(include = fundamental_cmds) launcher = LauncherSingletonWindow(app) launcher.show() app.run()
self.add( Button(position=(10, 140), size=(120, 25), title="Quit Launcher", action=self._close_cmd)) def _close_cmd(self): self._game_controller.quit() self._application.quit_cmd() def _btn_default(self): self._game_controller.launch_default() def _btn_tutorial(self): self._game_controller.launch_tutorial() def _btn_readme(self): subprocess.call(('open', '-a', 'TextEdit', 'README.md')) def _btn_licence(self): subprocess.call(('open', '-a', 'TextEdit', 'LICENCE.md')) if __name__ == '__main__': os.chdir(os.path.dirname(sys.argv[0])) app = application() app.menus = basic_menus(include=fundamental_cmds) launcher = LauncherSingletonWindow(app) launcher.show() app.run()
def make_window(x, scrolling, title): win = TestWindow(position = (x + 10, 50), size = (300, 400), auto_position = False, title = title) view = TextEditor(width = 300, height = 400, scrolling = scrolling, anchor = 'ltrb') win.view = view win.setup_tabs() view.text = tab_text win.add(view) view.become_target() win.show() say(""" There should be three text editing areas, one with no scrolling, one with vertical scrolling and with both horizontal and vertical scrolling. The ones without horizontal scrolling should wrap text to the width of the visible area. Text should re-wrap when the window is resized. There should be tab stops set at the spacing of the X characters in the top line, and the characters in the next line should line up with them. """) make_window(0, '', "No Scrolling") make_window(310, 'v', "Vertical Scrolling") make_window(620, 'hv', "Full Scrolling") app = application() app.menus = basic_menus() + menus app.run()
self.view.font = mono_font self.setup_tabs() def sans_cmd(self): self.view.font = sans_font self.setup_tabs() def setup_tabs(self): self.view.tab_spacing = self.view.font.width("X----") def make_window(): win = TestWindow(position=(10, 50), size=(600, 800), auto_position=True, title='The JSONing') view = TextEditor(width=600, height=800, scrolling='hv', anchor='ltrb') win.view = view win.setup_tabs() view.text = tab_text win.add(view) view.become_target() win.show() make_window() app = application() app.menus = basic_menus() + menus app.run()