def __init__(self): self.lines = [] self.running = False master = Tkinter.Tk() frame = self.make_button_frame(master) frame.pack() frame = self.make_slider_frame(master) frame.pack(fill=Tkinter.X) matplotlib.pyplot.ion() self.fig = plt.figure() self.ax = self.fig.add_subplot(111) matplotlib.pyplot.xlabel("Evaluations") matplotlib.pyplot.ylabel("Fitness") gui.init(600, 600, 10) self.canvas = Tkinter.Canvas(master, width=gui.xMax, height=gui.yMax + 40) self.canvas.pack() self.init_world()
def __init__(self): self.lines=[] self.running=False master = Tkinter.Tk() frame=self.make_button_frame(master) frame.pack() frame=self.make_slider_frame(master) frame.pack(fill=Tkinter.X) matplotlib.pyplot.ion() self.fig = plt.figure() self.ax = self.fig.add_subplot(111) matplotlib.pyplot.xlabel("Evaluations") matplotlib.pyplot.ylabel("Fitness") gui.init(600,600,10) self.canvas = Tkinter.Canvas(master, width=gui.xMax, height=gui.yMax+40) self.canvas.pack() self.init_world()
def load_game(): # LISTS # global GUI_LIST_BACKGROUND # global GUI_LIST_FOREGROUND # global FOOD_LIST # global BODY_PARTS_LIST GUI_LIST_FOREGROUND.empty() GUI_LIST_BACKGROUND.empty() FOOD_LIST.empty() BODY_PARTS_LIST.empty() gui.init() global SCROLL_AVANCEMENT SCROLL_AVANCEMENT = 0 global SCORE SCORE[0] = 0 head = he.Head((488, 320), HEAD_SIZE, HEAD_RADIUS) head.add(BODY_PARTS_LIST) ha.Hand((SCREEN_WIDTH // 4, 3 * SCREEN_HEIGHT // 4), 0, HAND_SPEED, HAND_SIZE, head, True).add(BODY_PARTS_LIST) ha.Hand((400, 200), 0, HAND_SPEED, HAND_SIZE, head, False).add(BODY_PARTS_LIST) pg.time.set_timer(pg.USEREVENT, 1000) pg.time.set_timer(MEM_MOUSE_EVENT, MEM_MOUSE_EVENT_TIME)
def __init__(self): progDir = os.path.dirname(sys.argv[0]) (self.args, files) = self.parseArgs(sys.argv[1:]) out.level = self.args.verbosity out(out.DEBUG, 'Parsed arguments: %s', self.args) self.config = CONFIG gui.init(self.config, files)
def __init__(self, app, lobby_type): logging.info('Initializing lobby') self.app = app self.lobby_type = lobby_type self.games_list = {} logging.info('Type: {}'.format(self.lobby_type)) logging.info('Loading fonts') self.title_font = utils.load_font('monofur.ttf', 24) self.normal_font = utils.load_font('monofur.ttf', 18) gui.init() self.gui_container = pygame.sprite.Group() if self.lobby_type == settings.LobbyStates.HOST_ONLINE_GAME: self.create_online_game() elif self.lobby_type == settings.LobbyStates.JOIN_ONLINE_GAME: self.get_online_games() pygame.time.set_timer(settings.Events.GET_ONLINE_GAMES.value, 5000) elif self.lobby_type == settings.LobbyStates.HOST_LAN_GAME: self.lan_announcer = networking.lan.Announcer( game_name=self.app.config.get('connectfour', 'game_name')) self.lan_announcer.start() networking.engine.Engine(settings.NetworkEngineMode.HOST, '') elif self.lobby_type == settings.LobbyStates.JOIN_LAN_GAME: self.lan_discoverer = networking.lan.Discoverer( self, self.games_list) self.lan_discoverer.start() pygame.time.set_timer(settings.Events.CLEAN_LAN_GAMES.value, 3000)
def init(self, loadSettings=True, loadTaskFile=True): import config, i18n settings = config.Settings(loadSettings) i18n.Translator(settings.get("view", "language")) import gui, persistence import domain.task as task import domain.effort as effort import meta self.wxApp.SetAppName(meta.name) self.wxApp.SetVendorName(meta.author) gui.init() if settings.getboolean("window", "splash"): splash = gui.SplashScreen() else: splash = None self.taskFile = persistence.TaskFile() self.autoSaver = persistence.AutoSaver(settings) self.taskRelationshipManager = task.TaskRelationshipManager(taskList=self.taskFile.tasks(), settings=settings) effortList = effort.EffortList(self.taskFile.tasks()) self.io = gui.IOController(self.taskFile, self.displayMessage, settings) self.mainwindow = gui.MainWindow(self.io, self.taskFile, effortList, settings, splash) self.processCommandLineArguments(settings, loadTaskFile)
def app_main(withgui): try: infomsg('loading TWISTED subsystem') from twisted.internet import reactor from twisted.logger import STDLibLogObserver, globalLogBeginner # redirect twisted logging to python logging globalLogBeginner.beginLoggingTo([STDLibLogObserver()]) infomsg('starting application.') # DHCP, DNS: find missing addresses setExternalPhoneAddress() setExternalGateway() setExternalProxyAddress() try: #force exception if not found config.get(consts.SECTION, consts.EXTPHONEADDR) config.get(consts.SECTION, consts.LOCPROXYADDR) config.get(consts.SECTION, consts.EXTGATEWAY) config.get(consts.SECTION, consts.EXTPROXYADDR) except: raise ZsiposCfgException("wrong or missing parameter") import rtp rtp.init() # @UndefinedVariable if withgui: def thread_init_cb(): rtp.register_gui_thread() # @UndefinedVariable import gui gui.init(thread_init_cb) # @UndefinedVariable log.info("loading SIP subsystem") import GMITM gmitm = GMITM.GMITM() if withgui: gmitm.setEventSink( gui.GUI_GMITMEventListener()) # @UndefinedVariable log.info("GMITM created.") reactor.callLater(1, rtp.postinit) # @UndefinedVariable reactor.run(installSignalHandlers=True) # @UndefinedVariable finally: try: gui.close() # @UndefinedVariable except: pass try: rtp.close() # @UndefinedVariable except: pass
def main(): print(gc + "~*~ Spore ~*~" + end) try: if len(argv) >= 1: user_input = argv[1] print("User Input: " + user_input) archive.process(user_input) except IndexError: gui.init()
def main(): window = gui.create_window() gui.init(window) gui.draw(window) for file_name in os.listdir(str(os.curdir)): if file_name == 'prefs.json': load_prefs() return init_prefs()
def init_world(self,w=None,h=None,marg=None): if w != None: gui.init(w,h,marg) self.world=world.World(self.generator_slider.get(), self.consumer_slider.get()) self.ga_init() #self.mutate_tokens.options(to=self.world.gene_length) gui.draw_world_init(self.world, self.canvas) self.clear_graph()
def init_world(self, w=None, h=None, marg=None): if w != None: gui.init(w, h, marg) self.world = world.World(self.generator_slider.get(), self.consumer_slider.get()) self.ga_init() #self.mutate_tokens.options(to=self.world.gene_length) gui.draw_world_init(self.world, self.canvas) self.clear_graph()
def load_gui(self): gui.init( theme=settings.GuiTheme(sounds_volume=self.app.config.getfloat( 'connectfour', 'sounds_volume'))) self.gui_container = pygame.sprite.Group() # Offline game button self.gui_container.add( self.create_menu_button(y=150, text='Offline game', on_click=self.btn_offline_game_click)) # Host an online game button self.gui_container.add( self.create_menu_button(y=210, text='Host an online game', on_click=self.btn_host_online_game_click, disabled=not self.app.dev_mode)) # Join an online game button self.gui_container.add( self.create_menu_button(y=260, text='Join an online game', on_click=self.btn_join_online_game_click, disabled=not self.app.dev_mode)) # Host a LAN game button self.gui_container.add( self.create_menu_button(y=320, text='Host a LAN game', on_click=self.btn_host_lan_game_click, disabled=not self.app.dev_mode)) # Join a LAN game button self.gui_container.add( self.create_menu_button(y=370, text='Join a LAN game', on_click=self.btn_join_lan_game_click, disabled=not self.app.dev_mode)) # Quit button self.gui_container.add( self.create_menu_button(y=430, text='Quit', on_click=self.btn_quit_click))
def SetMaintenanceMode(maint_mode): global maintenance_mode maintenance_mode = maint_mode if maint_mode: # Put photobooth in maintenance mode pygame.time.set_timer(EVT_BTN_BLINK, 0) gui.init(screen) gui.display_brb_screen(screen, "Please wait...", "I need to be serviced") pygame.event.clear() logger.info("PHOTOBOOTH BRB") else: # Resume normal photobooth operation gui.init(screen) gui.display_title_screen(screen, config.TITLE1, config.TITLE2, config.PRESS_BTN_TEXT) pygame.time.set_timer(EVT_BTN_BLINK, config.BTN_BLINK_RATE) pygame.event.clear() logger.info("RESUME OPERATION")
def main(blocking=True): # FIXME: check for all ports (unix, js, stm) # what is available in os module # maybe we can check it without try-except try: os.mkdir(storage_root) except: pass # schedules display autoupdates if blocking=False # it may cause GUI crashing when out of memory # but perfect to debug gui.init(blocking) ret = Secret.load_secret() if ret == False: Secret.generate_secret() screens.ask_pin(not ret, show_init) if blocking: ioloop()
def __init__(self): master = Tkinter.Tk() self.frame=Tkinter.Frame(master) self.frame.pack() matplotlib.pyplot.ion() matplotlib.pyplot.xlabel("Evaluations") matplotlib.pyplot.ylabel("Fitness") b = Tkinter.Button(self.frame, text="RANDOM WORLD", fg="black", command=self.init_world) c=0 b.grid(row=0,column=c) c+=1 b = Tkinter.Button(self.frame, text="RESET GA", fg="black", command=self.ga_init) b.grid(row=0,column=c) c+=1 b = Tkinter.Button(self.frame, text="STEP", fg="black", command=self.step) b.grid(row=0,column=c) c+=1 b = Tkinter.Button(self.frame, text="RUN (GA)", fg="black", command=self.run_ga) b.grid(row=0,column=c) c+=1 b = Tkinter.Button(self.frame, text="RUN (RANDOM)", fg="black", command=self.run_random) b.grid(row=0,column=c) c+=1 b = Tkinter.Button(self.frame, text="STOP", fg="black", command=self.stop) b.grid(row=0,column=c) c+=1 self.breed_flag= Tkinter.IntVar() b = Tkinter.Checkbutton(self.frame, text="BREED", fg="black", variable=self.breed_flag,command=self.breed_func) b.grid(row=0,column=c) #b.pack() c+=1 b = Tkinter.Button(self.frame, text="PLOT", fg="black", command=self.plot) b.grid(row=0,column=c) gui.init(600,600,10) self.canvas = Tkinter.Canvas(self.frame, width=gui.xMax, height=gui.yMax+40) self.canvas.grid(row=1,columnspan=c) self.run_init() self.init_world()
from gui import init if __name__ == "__main__": init()
def run_gui(): g.init() g.MY_WINDOW = mg.run_gui() g.gui_exit()
def main_game_loop(): '''Main game loop''' global DISPLAYSURF, FPSCLOCK, DECAL, decal_textures pygame.init() #must call init before any pygame functions are used DISPLAYSURF = pygame.display.set_mode( (SCREENWIDTH, SCREENHEIGHT) ) #creates game window FPSCLOCK = pygame.time.Clock() #Use with .tick() quit_game = False map_data.init() DECAL = {} decal_textures = SpriteAtlas('decal.png', 32, 2, 2) all_sprites_list = pygame.sprite.Group() #Initializes Group #OBJECT_MANAGER = {} '''TESTING''' for i in range(5,12): map_data.data[8][i] = LADDER for j in range(7,10): map_data.data[12][j] = LADDER for x in range(9, 12): for y in range(7,10): map_data.data[x][y] = GRASSL #for i in range(25): unit = Unit(5, 9) #Base class in unit_manager all_sprites_list.add(unit) #/ [random.choice((-5, 5)), random.choice((-5, 5))]) #fps vars fps_avg = 0.0 fps_avg_cntr = 0 fps_sum = 0.0 fps_cntr = 0 fps_text = pygame.font.SysFont('comicsansms.tff', 32) fps_low = 250 fps_high = 0 camera = Camera( SCREENWIDTH / 2, SCREENHEIGHT / 2 ) #textRect = fps_text.render(str(30)).get_rect() '''path = pathfinding.get_path(map_data, MAP_WIDTH, MAP_HEIGHT, pathfinding.Node(0,0), pathfinding.Node(13,10)) for pos in path: rint('{}, {}'.format(pos[0], pos[1]))''' #for t in range(2): map_data.data[15][9] = TREE #set stockpile position and add 5 wood items.init((1,9)) for i in range(2): items.add(items.WOOD) #test_surface = pygame.Surface((50,50),10, 10) #test_surface.set_colorkey gui.init() '''ENDTESTING''' #mouse control vars down_pos = None current_pos = None is_down = False paused = False #all_sprites_list = pygame.sprite.Group() #for run in range(25): while not quit_game: #---EVENTS-------------------------------------------------------------------------------------------------------------------EVENTS--- if is_down: cur_x, cur_y = pygame.mouse.get_pos() event_list = pygame.event.get() for event in event_list: if event.type == pygame.QUIT: quit_game = True pygame.quit() elif event.type == pygame.MOUSEBUTTONDOWN: is_down = True #print('Mouse Down', is_down) down_pos = pygame.mouse.get_pos() elif event.type == pygame.MOUSEBUTTONUP: is_down = False #print('Mouse Down', is_down) #x, y = pygame.mouse.get_pos() if gui.on_gui(cur_x,cur_y) == False: x, y = screen_to_grid(cur_x, cur_y) #add_decal(x, y, 0) #print(x, y) #do stuff at modified points #map_data.set_data(x//TILE_SIZE,y//TILE_SIZE, EMPTY) #print(x,y, map_data.get_data(x, y) ) elif event.type == pygame.KEYDOWN: if event.key == pygame.K_a: camera.x = camera.x - 1 elif event.key == pygame.K_d: camera.x = camera.x + 1 elif event.key == pygame.K_p: paused = not paused elif event.key == pygame.K_s: items.add(items.WOOD) elif event.key == pygame.K_x: for item in items.item_storage: if items.item_storage[item] > 0: print(items.item_database[item], items.item_storage[item]) if paused: continue all_sprites_list.update() #---DRAW GAME-------------------------------------------------------------------------------------------------------------------DRAW GAME--- DISPLAYSURF.fill(BGCOLOR) #Display FPS fps_cntr += 1 fps = FPSCLOCK.get_fps() fps_sum = fps_sum + fps if fps < fps_low: fps_low = fps if fps > fps_high: fps_high = fps if fps_cntr >= 60: fps_avg_cntr += 1 if fps_avg_cntr > 3: fps_avg = fps_sum / (fps_avg_cntr * fps_cntr) fps_sum = 0 fps_avg_cntr = 0 fps_low = 250 fps_high = 0 fps_cntr = 0 #---Draw Game----------------------------------------------------------------------- draw_map() DISPLAYSURF.blit(fps_text.render('{0:.2f} {1:2.2f} L:{2:.2f} H:{3:.2f}'.format( fps, fps_avg, fps_low, fps_high ), 0, (0,0,0)), [0, 0]) draw_decal() all_sprites_list.draw(DISPLAYSURF) gui.update(DISPLAYSURF) pygame.display.flip() FPSCLOCK.tick(FPS) #Delays until FPS == 1sec, If code finishes before FPS timer
import gui as myGui CHANNELS = 1 RATE = 44100 p = pyaudio.PyAudio() samples = [] max_delay = 2500 max_repeats = 5 max_volume = 5 max_volume_drop=5 gui = myGui.init(max_delay, max_repeats, max_volume, max_volume_drop) max_sample_size = int((max_delay / 1000) * max_repeats * RATE / 1024) delay = 500 number_of_repeats = 4 samples_size = int((delay / 1000) * number_of_repeats * RATE / 1024) single_sample_size = samples_size // number_of_repeats index = 0 def update(): global delay, number_of_repeats, samples_size, single_sample_size delay = gui['delay'].get() number_of_repeats = gui['repeats'].get() samples_size = int((delay / 1000) * number_of_repeats * RATE / 1024)
def main(): gui.init() # read config file conf = configparser.ConfigParser() conf.read('config.conf') dataset_dechron_file = conf['DEFAULT']['dataset_dechron_file'] tagdir = conf['DEFAULT']['tagdir'] grammar_file = conf['DEFAULT']['grammar_file'] # tokenizer to split text by sentences # tokenizer = nltk.data.load('tokenizers/punkt/PY3/french.pickle') # tokenizer to split text by words tokenizer = nltk.tokenize.TreebankWordTokenizer() # tagger initialisation for french pos tagging tagger = treetaggerwrapper.TreeTagger(TAGLANG='fr', TAGDIR=tagdir) dataset = utils.list_the_file(dataset_dechron_file) initiatives_list = [] # create list of initiatives from the dataset # (dechronological order, as per the file) for i in range(len(dataset)): opinion = '' if (dataset[i] != '') and (dataset[i][0] == "#"): if dataset[i + 1][0:4] == "Pour": opinion = 'pour' elif dataset[i + 1][0:4] == "Cont": opinion = 'contre' initiative = Initiative(dataset[i + 1], dataset[i + 3], dataset[i][1:5], opinion) initiatives_list.append(initiative) else: continue initiatives_list_dechron = sorted(initiatives_list, key=lambda initiative: initiative.date, reverse=True) initiatives_list_chron = initiatives_list_dechron[::-1] # utils.log("initiative list = ", initiatives_list_chron[:5]) # text analyze and predictions for i in range(len(initiatives_list_chron)): utils.treat_current_dataset(tokenizer, tagger, initiatives_list_chron[0:i + 1], initiatives_list_dechron[0:i + 1]) initiative = initiatives_list_dechron[i] gui.print_srt(gui.inner_text_win, 2, 1, initiative.title, initiative.content) gui.display_year(gui.win_date, initiative.date) gui.print_noun_values(gui.inner_nouns_win, config.nouns_dechron_predictions_list) gui.print_opinion_window(gui.win_op, config.pour_dechron_predictions_list, config.contre_dechron_predictions_list) gui.print_verb_adj_window(gui.win_adj, config.bottom_20_verbs_dechron, config.top_20_adj_dechron) # generate new initiative titles with most or less used words nouns = [w for w, p in config.nouns_chron_predictions_list[:3] + \ config.nouns_dechron_predictions_list[::-1][:3]] adjs = [a for a, p in config.top_20_adj_chron[:5] + \ config.bottom_20_adj_dechron[:5]] verbs = [v for v, p in config.bottom_20_verbs_chron[:5] + \ config.bottom_20_verbs_dechron[:5]] with open("listes.txt", "a") as text_file: print("\nNouns list = {}".format(nouns), file=text_file) print("\nAdjs list = {}".format(adjs), file=text_file) print("\nVerbs list = {}".format(verbs), file=text_file) titles = generator.generate_initiative(nouns, adjs, verbs) with open("generation.txt", "w") as text_file: for sentence in titles: print("{}".format(' '.join(sentence)), file=text_file) # pause to give time to read between initiatives time.sleep(1)
if frame is None: logger.critical("Can't get frame. No webcam attached?") del(camera) sys.exit(4) # Pygame initialization pygame.init() if config.FULLSCREEN: pygame.mouse.set_visible(False) flags = pygame.FULLSCREEN if config.FULLSCREEN else 0 window = pygame.display.set_mode( (config.WINDOW_SIZE_WIDTH, config.WINDOW_SIZE_HEIGHT), flags) pygame.display.set_caption( "Photobooth" ) screen = pygame.display.get_surface() # Initialize GUI gui.init(screen) # Initialize stats module stats.clear_all() # Start HTTP server cmdQ = Queue.Queue() http_server = server.http.HttpServer(event_dir, stats, cmdQ) http_server.start() # Display title screen and start press button text blink timer gui.display_title_screen(screen, config.TITLE1, config.TITLE2, config.PRESS_BTN_TEXT) pygame.time.set_timer(EVT_BTN_BLINK, config.BTN_BLINK_RATE) # Initialize variables capturedImages = []
def run(new_state): global running, state global key_down, key_pressed, key_released, mouse_down, mouse_pressed, mouse_released key_down = [False] * NUMKEYS key_pressed = [False] * NUMKEYS key_released = [False] * NUMKEYS mouse_down = [False] * NUMBUTTONS mouse_pressed = [False] * NUMBUTTONS mouse_released = [False] * NUMBUTTONS state = new_state pygame.init() gui.init() screen = pygame.display.set_mode((800, 600), pygame.DOUBLEBUF) clock = pygame.time.Clock() running = True while running: for i in range(NUMKEYS): key_pressed[i] = False for i in range(NUMKEYS): key_released[i] = False for i in range(NUMBUTTONS): mouse_pressed[i] = False for i in range(NUMBUTTONS): mouse_released[i] = False for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.KEYDOWN: if event.key < 0 or event.key > NUMKEYS: continue key_down[event.key] = True key_pressed[event.key] = True elif event.type == pygame.KEYUP: if event.key < 0 or event.key > NUMKEYS: continue key_down[event.key] = False key_released[event.key] = True elif event.type == pygame.MOUSEBUTTONDOWN: if event.button < 0 or event.button > NUMBUTTONS: continue mouse_down[event.button] = True mouse_pressed[event.button] = True elif event.type == pygame.MOUSEBUTTONUP: if event.button < 0 or event.button > NUMBUTTONS: continue mouse_down[event.button] = False mouse_released[event.button] = True time_passed = clock.tick(60) delta = time_passed / 1000.0 state.update(delta) screen.fill((100, 200, 255)) state.draw(screen) pygame.display.flip() state = None pygame.quit()
def testAppendUICommand(self): gui.init() toolbar = ToolBar(self.frame, {}) uiCommand = dummy.DummyUICommand(menuText='undo', bitmap='undo') id = toolbar.appendUICommand(uiCommand) self.assertNotEqual(wx.NOT_FOUND, toolbar.GetToolPos(id))
#!/bin/python3 import asyncio import fbchat import websockets import gui all_users = {} all_messages = {} conversations = {} loop = asyncio.get_event_loop() loop.run_until_complete(gui.init())
import gui import strains if __name__ == "__main__": all_strains = strains.parse_strains_files() strains_indices = strains.build_strains_indices(all_strains) gui.init(all_strains, strains_indices)
def __init__(self): master = Tkinter.Tk() self.frame = Tkinter.Frame(master) self.frame.pack() matplotlib.pyplot.ion() matplotlib.pyplot.xlabel("Evaluations") matplotlib.pyplot.ylabel("Fitness") b = Tkinter.Button(self.frame, text="RANDOM WORLD", fg="black", command=self.init_world) c = 0 b.grid(row=0, column=c) c += 1 b = Tkinter.Button(self.frame, text="RESET GA", fg="black", command=self.ga_init) b.grid(row=0, column=c) c += 1 b = Tkinter.Button(self.frame, text="STEP", fg="black", command=self.step) b.grid(row=0, column=c) c += 1 b = Tkinter.Button(self.frame, text="RUN (GA)", fg="black", command=self.run_ga) b.grid(row=0, column=c) c += 1 b = Tkinter.Button(self.frame, text="RUN (RANDOM)", fg="black", command=self.run_random) b.grid(row=0, column=c) c += 1 b = Tkinter.Button(self.frame, text="STOP", fg="black", command=self.stop) b.grid(row=0, column=c) c += 1 self.breed_flag = Tkinter.IntVar() b = Tkinter.Checkbutton(self.frame, text="BREED", fg="black", variable=self.breed_flag, command=self.breed_func) b.grid(row=0, column=c) #b.pack() c += 1 b = Tkinter.Button(self.frame, text="PLOT", fg="black", command=self.plot) b.grid(row=0, column=c) gui.init(600, 600, 10) self.canvas = Tkinter.Canvas(self.frame, width=gui.xMax, height=gui.yMax + 40) self.canvas.grid(row=1, columnspan=c) self.run_init() self.init_world()
class MyInterface(gui.GameInterface): def piece_clicked(self, row, column, section, piece): piece.selected = not piece.selected print("{}, {} Section: {}".format(row, column, section)) def reverse_clicked(self, clockwise): print(clockwise) gui.set_points(100) def piece_section_entered(self, section, piece): print("Section entered {}".format(section)) def hint_asked(self): print("Para k kieres saber eso jaja saludos") def save_game(self): print("Save game") gui.init() gui.set_quality("ultra") # low, medium, high ultra gui.set_animations(False) gui.set_scale(1) # Any float different from 0 gui.set_game_interface(MyInterface()) # GUI Listener gui.add_piece(0, 0, random.choice(variables.HEXAGON_TYPES)) gui.run()
def new_game(): print('--- NEW GAME ---') factory.shots = [] init()
log.basicConfig( level=log.DEBUG, format='[%(levelname)s] %(message)s - %(module)s::%(funcName)s(%(lineno)d)' ) from globe import Globe as globe import gui import workspace import blueprint import paste as autopaste if __name__ == '__main__': freeze_support() blueprint.default() # 加载默认蓝图,最好在最前面执行 workspace.cwd() # 加载默认工作路径,即 py 所在路径 #TODO 保存上次的工作路径? threads = [] thread_autopaste = threading.Thread(target=autopaste.trigger, args=(), name="AutopasteThread") threads.append(thread_autopaste) thread_autopaste.setDaemon(True) thread_autopaste.start() # 启动自动复制线程 gui.init() # 启动 GUI # 据称 Tk ‘线程不安全’,只能在主线程中执行 log.info("Program terminated")
import tkinter as tk import gui import pi # ROOM = "50_milk_women_1" ROOM = "50_milk_women_2" USE_GUI = 1 if USE_GUI: gui.init(ROOM) else: print("USE_PI")
def realizar_simulacion(): duracion = pedir_numero_de_dias() gui.init() casino = Casino(DINERO_INICIAL, duracion) casino.iniciar_casino() gui.run(casino.tick_simulacion, 100/16)
# listo def guardar_juego(self): if self.hint == "": pass else: gui.pop_piece(int(self.hint[0]), int(self.hint[1])) self.hint = "" self.numeros += 1 DATOS.guardados.agregar_nodo(DATOS.puestas.len) gui.add_number(self.numeros, self.color) print("Presionaron guardar") if __name__ == 'demo': def hook(type, value, traceback): print(type) print(value) print(traceback) sys.__excepthook__ = hook gui.set_scale(False) # Any float different from 0 gui.init() gui.set_quality("ultra") # low, medium, high ultra gui.set_animations(False) gui.init_grid() gui.set_game_interface(MyInterface()) # GUI Listener gui.run()
import gui import streaming gui.init(streaming.start_listening, streaming.start_camera_steam, streaming.start_screen_sharing, streaming.start_audio_stream)