class ThreadedClient: def __init__(self, master): self.master = master self.config=ConfigManager() self.keyTrainer=keyboardStatus(self.config) keyTrainer=self.keyTrainer master.protocol('WM_DELETE_WINDOW', self.kill_and_destroy) self.guiManager=GuiManager(master,self.config,keyTrainer.myQueue,keyTrainer) keyTrainer.begin_scan() self.running = 1 self.periodicCall() def kill_and_destroy(self): self.running = 0 self.keyTrainer.stop_scan() if self.config.debug: print "Stopping scan..." self.master.destroy() def periodicCall(self): self.guiManager.processQueue() if not self.running: # import sys # sys.exit(1) self.kill_and_destroy() self.master.after(20, self.periodicCall)
class App(wx.App): def OnInit(self): self.manager = GuiManager(self.UpdateUI) self.frame = self.manager.GetFrame(2) self.frame.Show(True) return True def UpdateUI(self, type): self.frame.Show(False) self.frame = self.manager.GetFrame(type) self.frame.Show(True)
def __init__(self, master): self.master = master self.config=ConfigManager() self.keyTrainer=keyboardStatus(self.config) keyTrainer=self.keyTrainer master.protocol('WM_DELETE_WINDOW', self.kill_and_destroy) self.guiManager=GuiManager(master,self.config,keyTrainer.myQueue,keyTrainer) keyTrainer.begin_scan() self.running = 1 self.periodicCall()
def OnInit(self): self.manager = GuiManager(self.UpdateUI) self.frame = self.manager.GetFrame(2) self.frame.Show(True) return True
AssetsReader() towersManager = TowersManager() map_elements_list = MapReader().get_map_elements() pygame.mouse.set_visible(False) clock = pygame.time.Clock() waveManager = WaveManager() all_sprites_list = Group(map_elements_list) all_sprites_list.add(gameCommon.enemies_list) all_sprites_list.add(gameCommon.towers_list) guiManager = GuiManager() background = pygame.Surface(WINDOW_SIZE) background.fill(BACKGROUND_COLOR) done = False while not done: waveManager.update() mouse_position = pygame.mouse.get_pos() for event in pygame.event.get(): if event.type == pygame.QUIT: done = True elif event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT_BUTTON: towersManager.create_new_tower() clicked = guiManager.check_click(mouse_position)