def main(): features.FEATURE_FILE_PATH = os.path.join(save.get_save_dir(), 'features') features.parse_options() setup_game_version() setup_android_version() setup_errors() maybe_start_remote_debug() monitor.start() save.start_zygote() client.window.init_screen() osutil.init() ui.init() ui.set_fill_image(graphics.load_image('data/user/background.jpg')) setup_freeciv_config() client.window.init() gamescreen.init() start_autoupdate() start_marketnotice() client.freeciv.run()
def main(size=None, init=True): features.FEATURE_FILE_PATH = os.path.join(save.get_save_dir(), 'features') features.parse_options() setup_game_version() setup_android_version() setup_errors() size = size or check_force_size() maybe_start_remote_debug() monitor.start() client.window.init_screen(size) osutil.init() ui.init() ui.set_fill_image(None) unpack_data() ui.set_fill_image(pygame.image.load('data/user/background.jpg')) setup_freeciv_config() client.window.init() gamescreen.init() start_autoupdate() if init: client.freeciv.run() else: client_main()
def compile(): ui.init() #select osu! song path directory ui.popupmsg("Please select your osu! song path directiory.") songpath = ui.getdirectory() ui.popupmsg("You have selected your song directory path as: " + songpath) #select location in which list will be created ui.popupmsg( "Please input the location where you would like your song ID list to be saved." ) songlistlocation = ui.getdirectory() ui.popupmsg("Creating song ID list at " + songlistlocation) songid = open(songlistlocation + "/songs_setid.osm", "w+") #create list #for each folder in the song directory, chop off the id number in the beginning of the name and write it to the list for entry in os.listdir(songpath): x = entry.split(' ')[0].split('+')[0] songid.write(x + '\n') #close file and quit ui.popupmsg( "Success! Your .osm containing your map IDs has been created at " + songlistlocation + "/songs_setid.osm") songid.close() quit()
def enter(): global bl, br, bt, bb bl, br, bt, bb = get_canvas_width() // 2 - 170, get_canvas_width( ) // 2 + 170, get_canvas_height() // 2 + 30 - 170, get_canvas_height( ) // 2 + 30 + 170 gfw.world.init(['ui', 'dice', 'bullet', 'enemy']) ui.init() generator.init() gfw.world.add(gfw.layer.ui, ui) global font, stagefont font = gfw.font.load('res/ConsolaMalgun.ttf', 15) stagefont = gfw.font.load('res/ConsolaMalgun.ttf', 40) global dicecost, fastcost, slowcost, multicost global isclick, target initgame() isclick = False target = None global buttonsound buttonsound = load_wav('res/button.wav') buttonsound.set_volume(15)
def main(): features.parse_options() setup_game_version() setup_android_version() setup_errors() maybe_start_remote_debug() monitor.start() save.start_zygote() client.window.init_screen() osutil.init() set_logical_size() ui.init() ui.set_fill_image(graphics.load_image('data/user/background.jpg')) setup_freeciv_config() client.window.init() gamescreen.init() start_autoupdate() start_marketnotice() ctrl.maybe_init() client.freeciv.run()
def init(): global logger, screen, clock, resolution, background, camera, stage loadConfigs() logger = outputLogger(" GAME ") logger.info("Initializing.") pygame.init() pygame.display.set_caption("Spellworld") screen = pygame.display.set_mode(resolution) clock = pygame.time.Clock() camera = pygame.Rect(map_size["width"] / 2, map_size["height"] / 2, resolution[0], resolution[1] - ui.height) camera.x -= camera.w / 2 camera.y -= camera.h / 2 stage = pygame.surface.Surface(resolution) rect = pygame.Rect(0, 0, resolution[0], resolution[1] - ui.height) background = stage.subsurface(rect) background.fill(colors.BLUE) aether.init() createPlayer() ui.init() world.init(resolution) pygame.mouse.set_visible(False) mouseInteraction("standard") logger.info("Creating {0} game.".format(resolution))
def run(filename): w = pyglet.window.Window(fullscreen=True) ui.init(w) @w.event def on_key_press(k, *etc): if k == key.ESCAPE: pyglet.app.exit() glPointSize(2) glClearColor(.2, .2, .2, 1.) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glEnable(GL_BLEND) ui.desktop.add_child(ui.window_from_dicttree(yaml.load(file(filename)))) stackless.tasklet(pyglet.app.run)() stackless.run()
def main(): if sys.argv[1:] and sys.argv[1] == 'server': from freeciv.client import _freeciv import os _freeciv.func.py_server_main_run(sys.argv[2:]) os._exit(0) features.parse_options() if features.get('debug.dsn'): sys.excepthook = early_except_hook maybe_setup_launch_param() setup_game_version() setup_android_version() setup_errors() maybe_notify_about_launch() maybe_start_remote_debug() monitor.start() if features.get('app.fork'): save.start_zygote() init_window() client.window.init_screen() osutil.init() #Disable "set_logical_size" feature because # - it needs patching SDL # - there is a zoom feature in the game. # - it makes the graphics to be more blurred because they are zoomed twice when using game zoom #if not osutil.is_desktop: # set_logical_size() # Deleted. See lib/ui/core.py:scale_for_device ui.init() ui.set_fill_image(graphics.load_image('userdata/background.jpg')) client.window.init() gamescreen.init() start_autoupdate() start_marketnotice() if ctrl: ctrl.maybe_init() client.freeciv.run(['--log', monitor.get_log_path_base() + '.log'])
def main(): print(sm64net.VERSION_STR + "\n" "Copyright (C) 2019 - 2022 devwizard\n" "This project is licensed under the terms of the GNU General Public " "License\n" "version 2. See LICENSE for more information.") server.init() ui.init() try: while ui.update(): server.update() time.sleep(1.0 / 60) finally: ui.exit() server.exit() return 0
def main(): sly.logger.info("Script arguments", extra={ "context.teamId": g.team_id, "context.workspaceId": g.workspace_id, "modal.state.slyProjectId": g.project_id, }) g.my_app.compile_template(g.root_source_dir) data = {} state = {} data["taskId"] = g.task_id ui.init(data, state) # init data for UI widgets g.my_app.run(data=data, state=state)
def start_app(): '''Starts the main application''' ui.init() global app_started app_started = True if "-nosplash" not in sys.argv: ui.display_splash() ui.refresh() #threading._start_new_thread(ui.refresh_thread, ()) # Start listening for user input input_listener.listen()
def main(): if sys.argv[1:] and sys.argv[1] == 'server': from freeciv.client import _freeciv import os _freeciv.func.py_server_main_run(sys.argv[2:]) os._exit(0) features.parse_options() if features.get('debug.dsn'): sys.excepthook = early_except_hook maybe_setup_launch_param() setup_game_version() setup_android_version() setup_errors() maybe_notify_about_launch() maybe_start_remote_debug() monitor.start() if features.get('app.fork'): save.start_zygote() init_window() client.window.init_screen() osutil.init() if not osutil.is_desktop: set_logical_size() ui.init() ui.set_fill_image(graphics.load_image('data/user/background.jpg')) setup_freeciv_config() client.window.init() gamescreen.init() start_autoupdate() start_marketnotice() if ctrl: ctrl.maybe_init() client.freeciv.run()
def play_game(player): ui.init() while not libtcodpy.console_is_window_closed(): renderer.render_all(player) player.current_map.fov_needs_recompute = False libtcodpy.console_flush() for entity in player.current_map.map_entities: renderer.clear_entity(entity) player_action = handle_input(player) if player_action == 'exit': break if player.game_state == 'playing' and player_action != 'didnt-take-turn': for entity in player.current_map.map_entities: if entity.ai: entity.ai.take_turn(player)
def start(): pg.init() pg.display.set_mode((width, height), flags=pg.SCALED | pg.RESIZABLE) pg.display.set_caption('card game') save.init() image_handler.init() spritesheet.init() customsheet.init() menu.init() client.init() game.init() network.init() builder.init() ui.init() main_menu = ui.Menu(get_objects=menu.main_menu) main_menu.run() pg.quit()
def main(): os.environ['SDL_VIDEO_CENTERED'] = '1' pygame.display.init() pygame.mixer.init(44100) #pygame.mouse.set_visible(False) pygame.display.set_caption("Opencraft") pygame.display.set_icon(read.read_exe_icon("files\\starcraft.exe")) image = read.read_pcx("glue\\title\\title.pcx") music.start("music\\title.wav") ui.init() display_image(image) import Config if not Config.config.introduction_played: play_introduction() Config.config.introduction_played = True def campaign_editor(): print "campaign editor" def credits(): print "credits" ui.GlxMenu.GlxMenu("rez\\glumain.bin", "glue\\palmm\\backgnd.pcx", { 3: lambda: ui.GlxMenu.GlxMenu("rez\\gluexpcmpgn.bin", "glue\\palcs\\backgnd.pcx", { 5: lambda: 0, # save 6: lambda: 0, # protoss 7: lambda: 0, # terran 8: lambda: 0, # zerg 10: lambda: ui.GlxMenu.GlxMenu("rez\\glucreat.bin", "glue\\palcs\\backgnd.pcx", { 12: lambda: credits(), }).execute(), }).execute(), 4: lambda: ui.GlxMenu.GlxMenu("rez\\gluconn.bin", "glue\\palnl\\backgnd.pcx", { 321312: "a", }).execute(), 5: campaign_editor, 8: play_introduction, 9: lambda: ui.GlxMenu.GlxMenu("rez\\credits.bin", "glue\\palmm\\backgnd.pcx", {}).execute(), }).execute()
def download(): ui.init() http = urllib3.PoolManager() ui.popupmsg("Select the .osm file you want to import maps from.") osm = ui.getfilename() if osm[len(osm) - 4:] == ".osm": #making sure selected file is of correct filetype ui.popupmsg("Downloading maps listed in: " + osm) with open(osm) as f: for line in f: mapdownload = http.request( 'GET', "https://bloodcat.com/osu/s/" + line) with open("./dldest/" + line + ".osz", "wb") as osumap: osumap.write(mapdownload.data) mapdownload.release_conn() time.sleep(10) else: ui.popupmsg( "Error! File selected not of type .osm! Please make sure your ID list has the correct filetype and try again." ) ui.popupmsg("Success!") f.close() quit()
def play(self): ui.init(self) ui.title_screen() self.start() self.loop() ui.close()
def client(args): def fetchUpdated(sock): ret = request(sock, 'GETUPD'.encode('ascii')) if str(ret) in err: y, x = 1, 2 ui.alert(y, x, err[ret]) ui.exit() quit() else: return eval(ret) def fetchSchema(sock): ret = request(sock, 'GETSCH'.encode('ascii')) if str(ret) in err: y, x = 1, 2 ui.alert(y, x, err[ret]) ui.exit() quit() else: return eval(ret) def fetchRecords(sock): ret = request(sock, 'GETRECS'.encode('ascii')) if str(ret) in err: y, x = 1, 2 ui.alert(y, x, err[ret]) ui.exit() quit() else: return eval(ret) ui.init() cache = cachemgr.Cache(host='localhost', port=11211) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sock.connect((args.host, args.p)) except: y, x = 1, 2 ui.alert(y, x, err['CONNREF']) ui.exit() quit() server_time = fetchUpdated(sock) schema = fetchSchema(sock) collect = fetchRecords(sock) cache.consolidate(server_time, schema, collect) schema = cache.getSchema() collect = cache.getRecords() sel = 0 while True: y, x = 1, 2 height = 13 ret = ui.menuwin(y, x, height, sel, schema, collect) if ui.keyboard['ESC'] in ret: sel = ret[1] y, x = 1, 2 if ui.confirm(y, x, 'EXIT?'): ret = request(sock, 'CONNEND'.encode('ascii')) if str(ret) in err: y, x = 1, 2 ui.alert(y, x, err[ret]) elif str(ret) in succ: y, x = 1, 2 ui.alert(y, x, succ[ret]) ui.exit() quit() elif ui.keyboard['S'] in ret: sel = ret[1] y, x = 1, 2 title = 'SEARCH' length = 30 typech = 'VARCHAR' ret = ui.textwin(y, x, typech, length, title, False) if not ret == ui.keyboard['ESC']: sel = 0 if not cache.getUpdated() == server_time: y, x = 1, 2 ui.alert(y, x, 'CONSOLIDATING...') collect = fetchRecords(sock) cache.consolidate(server_time, schema, collect) search = cache.search(ret) if not search: y, x = 1, 2 ui.alert(y, x, err['NOREC']) else: y, x, 1, 2 ui.alert(y, x, '{} RECORD(S) FOUND.'.format(len(search))) collect = search elif ui.keyboard['A'] in ret: sel = ret[1] attrs, lens, typechs, is_hiddens = [], [], [], [] for s in schema: attrs.append(str(s[0])) lens.append(int(s[1])) typechs.append(str(s[2])) is_hiddens.append(False) y, x = 1, 2 ret = ui.multitextwinv(y, x, typechs, lens, attrs, is_hiddens) if not ret == ui.keyboard['ESC']: req = '{}#{}'.format('ADDREC', repr(ret)) ret = request(sock, req.encode('ascii')) if str(ret) in err: y, x = 1, 2 ui.alert(y, x, err[ret]) elif str(ret) in succ: y, x = 1, 2 ui.alert(y, x, succ[ret]) sel = 0 server_time = fetchUpdated(sock) elif ui.keyboard['D'] in ret and collect: sel = ret[1] for i, rec in enumerate(collect): if i == sel: key = rec[schema[0][0]] y, x = 1, 2 if ui.confirm(y, x, 'DELETE {}?'.format(key)): req = '{}#{}'.format('DELREC', repr(key)) ret = request(sock, req.encode('ascii')) if str(ret) in err: y, x = 1, 2 ui.alert(y, x, err[ret]) elif str(ret) in succ: y, x = 1, 2 ui.alert(y, x, succ[ret]) sel = 0 server_time = fetchUpdated(sock) elif ui.keyboard['R'] in ret: y, x = 1, 2 if ui.confirm(y, x, 'REFRESH?'): server_time = fetchUpdated(sock) collect = fetchRecords(sock) cache.consolidate(server_time, schema, collect) if not cache.getUpdated() == server_time: y, x = 1, 2 ui.alert(y, x, 'CONSOLIDATING...') collect = fetchRecords(sock) cache.consolidate(server_time, schema, collect)
#!/usr/bin/env python import auth, notification, wlan from log import log, lock import sys, threading NO_UI = False if not NO_UI: import ui tb = ui.init() if not lock(): if NO_UI: # This is important enough to print to the screen. print "Error: could not obtain lockfile, quitting" else: tb.notice( "Another instance of Airbears Supplicant is already running.") sys.exit(-1) else: log("Lockfile acquired") log("Started AirBears supplicant") log("NO_UI = " + str(NO_UI)) if not NO_UI: tb.notice("Welcome to AirBears Supplicant") def connection_callback():
#!/usr/bin/env python import auth, notification, wlan from log import log, lock import sys, threading NO_UI = False if not NO_UI: import ui tb = ui.init() if not lock(): if NO_UI: # This is important enough to print to the screen. print "Error: could not obtain lockfile, quitting" else: tb.notice("Another instance of Airbears Supplicant is already running.") sys.exit(-1) else: log("Lockfile acquired") log("Started AirBears supplicant") log("NO_UI = " + str(NO_UI)) if not NO_UI: tb.notice("Welcome to AirBears Supplicant") def connection_callback(): log("Received connection notification") if wlan.has_airbears():
def client(hostname, port): ui.init() sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sock.connect((hostname, port)) except: ui.alert(2, 2, ERROR['CONNREF'][1]) ui.exit() quit() ret = '' while not ret == 'SIGNON': ret = ui.multitextwinv(2, 2,\ [ 'VARCHAR', 'VARCHAR' ],\ [ 10, 20 ],\ [ 'USERNAME', 'PASSWORD' ],\ [ False, True ]) if ret == ui.keyboard['ESC']: ui.exit() quit() else: username = ret[0] password = hashlib.sha224(ret[1].encode('ascii')).hexdigest() args = {'username': username, 'password': password} ui.message(2, 2, REQUEST['LOGON'][1]) ret = REQUEST['LOGON'][3](sock, args) ret_msg = '' if str(ret) in SUCCESS: ret_code, ret_msg = SUCCESS[ret][0], SUCCESS[ret][1] elif str(ret) in ERROR: ret_code, ret_msg = ERROR[ret][0], ERROR[ret][1] ui.alert(2, 2, ret_msg) break t = threading.Thread(target=clientthread, args=(9, 3, 16, 75, sock)) t.daemon = True t.start() while not rdy_event.is_set(): continue # wait for client thread. ui.window(2, 81, 22, 15,\ ui.curses.color_pair(ui.colors['W/BK']),\ True) ui.window(2, 2, 3, 75,\ ui.curses.color_pair(ui.colors['W/BK']),\ True) ui.message(3, 4, REQUEST['GETMSGS'][1]) REQUEST['GETMSGS'][3](sock, args) while not msg_event[1].is_set(): continue # wait for client thread. if not str(msg_event[0]) == 'NOMSGS': msg_event[1] = threading.Event() ui.optionwinh(2, 2, 3, 75,\ [ [ '\u25B2/\u25BC', 'SELECT' ],\ [ 'RET', 'CLOSE' ],\ [ 'ESC', 'CLOSE' ] ]) ui.menuwin(28, 2, 5, 0,\ [ [ 'FROM', '11', 'VARCHAR' ], [ 'MESSAGE', '76', 'VARCHAR' ] ],\ msg_event[0]) while True: ui.window(2, 2, 3, 75,\ ui.curses.color_pair(ui.colors['W/BK']),\ True) ui.optionwinv(2, 81, 22, 15,\ [ [ 'RET', 'INPUT' ],\ [ 'U', 'USERS' ],\ [ 'ESC', 'LOGOUT' ] ]) key = ui.stdscr.getch() if key == ui.keyboard['ESC']: ui.optionwinv(2, 81, 22, 15,\ [ [ '\u25C0/\u25B6', 'SELECT' ],\ [ 'RET', 'SUBMIT' ],\ [ 'ESC', 'CANCEL' ] ]) if ui.confirm(3, 4, 'LOG OUT?') == 0: break elif key == ui.keyboard['ENTER']: ui.optionwinv(2, 81, 22, 15,\ [ ['RET', 'SUBMIT'],\ ['ESC', 'CANCEL' ] ]) ret = ui.multitextwinh(2, 2,\ [ 'VARCHAR', 'VARCHAR' ],\ [ 10, 57 ],\ [ 'TO', 'MESSAGE' ],\ [ False, False ]) if not ret == ui.keyboard['ESC']: args['receiver'], args['message'] = ret[0], ret[1] ui.window(2, 2, 3, 75,\ ui.curses.color_pair(ui.colors['W/BK']),\ True) ui.message(3, 4, REQUEST['SENDMSG'][1]) REQUEST['SENDMSG'][3](sock, args) elif key == ui.keyboard['U']: ui.window(2, 81, 22, 15,\ ui.curses.color_pair(ui.colors['W/BK']),\ True) ui.message(3, 4, REQUEST['GETUSRS'][1]) REQUEST['GETUSRS'][3](sock, args) while not usr_event[1].is_set(): continue # wait for client thread. usr_event[1] = threading.Event() ui.optionwinh(2, 2, 3, 75,\ [ [ '\u25B2/\u25BC', 'SELECT' ],\ [ 'RET', 'CLOSE' ],\ [ 'ESC', 'CLOSE' ] ]) ui.menuwin(2, 81, 22, 0,\ [ ['USER', '10', 'VARCHAR' ] ],\ usr_event[0]) ui.message(3, 4, REQUEST['LOGOFF'][1]) REQUEST['LOGOFF'][3](sock, args) sock.close() ui.exit() quit()
app.addEndpoint( webserver.routing.RegexMatch( "z3/keywords/group/(?P<bgroup>[^/]+)"), self._tcontroller.getStringOperationDataForGroup) app.addEndpoint(webserver.routing.RegexMatch("z3/keywords/best"), self._rcontroller.getBestSolverForStringOperations) app.addEndpoint(webserver.routing.RegexMatch("z3/faster"), self._rcontroller.compareSequenceSolverAndArrangement) app.addEndpoint(webserver.routing.RegexMatch("lol"), self._rcontroller.getSimple) self._app = app def startServer(self): self._app.run() if __name__ == "__main__": import sys if (len(sys.argv) >= 2): db = storage.sqlitedb.DB(sys.argv[1]) else: import os import ui uii = ui.SelectDB(os.path.dirname(os.path.realpath(__file__))) ui.init(uii) db = uii.db Server(db).startServer()
pygame.display.init() pygame.font.init() resolution = [64,64] #The resolution of the map (I have tested up to 1024x1024, which will take about 10s to load) screen_size = [800,600] multisample = 16 icon = pygame.Surface((1,1)); icon.set_alpha(0); pygame.display.set_icon(icon) pygame.display.set_caption("Map Editor - Ian Mallett - v.15.0.0 - 2012") if multisample: pygame.display.gl_set_attribute(GL_MULTISAMPLEBUFFERS,1) pygame.display.gl_set_attribute(GL_MULTISAMPLESAMPLES,multisample) pygame.display.set_mode(screen_size,OPENGL|DOUBLEBUF) pygame.display.set_icon(pygame.transform.smoothscale(pygame.image.load("data/icon.png"),[24,24])) gl_util.init_gl() ui.init(screen_size) glPointSize(5) glLineWidth(2) glHint(GL_LINE_SMOOTH_HINT,GL_NICEST) class Application: def __init__(self): map.Map.init() self.reset_camera() self.map = map.Map.new(resolution) self.tools = {"raise":tools.ToolRaise(),"lower":tools.ToolLower()} self.current_tool = "lower"
def init(): """Initialize this activity""" ui.init()
import webbrowser import time import ui ui.init() ui.popupmsg("Select the .osm file you want to import maps from.") osm = ui.getfilename() if osm[len(osm) - 4:] == ".osm": #making sure selected file is of correct filetype ui.popupmsg("retrieving files from: " + osm) with open(osm) as f: for line in f: webbrowser.open("https://osu.ppy.sh/beatmapsets/" + line + "/download") time.sleep(20) else: #print incorrect filetype error message ui.popupmsg( "Error! File selected not of type .osm! Please make sure your ID list has the correct filetype and try again." ) ui.popupmsg("Success!") f.close() quit()
import os import ntpath import ui import latex.summ_table import latex.summ_table_woorpje import latex.summ_table_all import latex.cactus import markdown.summ_table import markdown.markdown import storage from datetime import date uii = ui.SelectDB (os.path.dirname(os.path.realpath(__file__))) ui.init (uii) db = uii.db trackinstance = storage.sqlitedb.TrackInstanceRepository (db) track = storage.sqlitedb.TrackRepository(db,trackinstance) results = storage.sqlitedb.ResultRepository (db,track,trackinstance) finalui = ui.ConfigureTableGeneration (results,track) ui.init (finalui) print (finalui.groups,finalui.solvers,finalui.loc,finalui.tableStyle) if finalui.tableStyle == "ASCIIDoctor page": table = markdown.markdown.MarkdownGenerator (results,track,finalui.solvers,finalui.groups) #markdown.summ_table.TableGenerator (results,track,finalui.solvers,finalui.groups) elif finalui.tableStyle == "LaTeX - Cactus Plot (total)": table = latex.cactus.CactusGenerator (results,track,finalui.solvers,finalui.groups,True) elif finalui.tableStyle == "LaTeX - Cactus Plot (benchmark groups)": table = latex.cactus.CactusGenerator (results,track,finalui.solvers,finalui.groups,False)
def open_window(): w = pyglet.window.Window() ui.init(w) pyglet.clock.schedule(lambda dt: stackless.schedule()) stackless.tasklet(pyglet.app.run)() return w
def main(): os.environ['SDL_VIDEO_CENTERED'] = '1' pygame.display.init() pygame.mixer.init(44100) #pygame.mouse.set_visible(False) pygame.display.set_caption("Opencraft") pygame.display.set_icon(read.read_exe_icon("files\\starcraft.exe")) image = read.read_pcx("glue\\title\\title.pcx") music.start("music\\title.wav") ui.init() display_image(image) import Config if not Config.config.introduction_played: play_introduction() Config.config.introduction_played = True def campaign_editor(): print "campaign editor" def credits(): print "credits" ui.GlxMenu.GlxMenu( "rez\\glumain.bin", "glue\\palmm\\backgnd.pcx", { 3: lambda: ui.GlxMenu.GlxMenu( "rez\\gluexpcmpgn.bin", "glue\\palcs\\backgnd.pcx", { 5: lambda: 0, # save 6: lambda: 0, # protoss 7: lambda: 0, # terran 8: lambda: 0, # zerg 10: lambda: ui.GlxMenu.GlxMenu("rez\\glucreat.bin", "glue\\palcs\\backgnd.pcx", { 12: lambda: credits(), }).execute(), }).execute(), 4: lambda: ui.GlxMenu.GlxMenu("rez\\gluconn.bin", "glue\\palnl\\backgnd.pcx", { 321312: "a", }).execute(), 5: campaign_editor, 8: play_introduction, 9: lambda: ui.GlxMenu.GlxMenu( "rez\\credits.bin", "glue\\palmm\\backgnd.pcx", {}).execute(), }).execute()
import normalizer import numpy as np import PIL from ui import init from neuralnetwork import NeuralNetwork init() img = PIL.Image.open("image.png").convert("L") imgarr = np.array(img) print("imagearray created") np.set_printoptions(threshold=np.nan) normalized_input = normalizer.normalizeInput(imgarr) nn = NeuralNetwork(normalized_input, np.ndarray(shape=(10))) nn.feedforward() print(nn.result())
for word in text.split(): img = self.font.render(word, 1, self.color) if current_width != 0 and img.get_width() + current_width > self.width: words = [] lines.append(words) current_width = 0 words.append(img) current_width += img.get_width() + spacing height = sum( max([ word.get_height() for word in line ] + [0]) for line in lines ) surf = pygame.Surface((width, height), pygame.SRCALPHA) y = 0 for line in lines: if not line: continue x = 0 for word in line: surf.blit(word, (x, y)) x += word.get_width() + spacing y += max( word.get_height() for word in line ) return surf if __name__ == '__main__': import os; os.chdir('..') pygame.display.set_mode((800, 480)) ui.init() w = LongTextWidget(open('data/android-help.txt').read(), 800, ui.consolefont) ui.set(w) ui.main()