def assign(self, x, y, z): global Feature_chosen global Processing_unit_chosen global Measurement_type_chosen Feature_chosen = x Processing_unit_chosen = y Measurement_type_chosen = z w = open(aux_file, 'w') w.truncate(0) w.write(Feature_chosen + "," + Processing_unit_chosen + "," + Measurement_type_chosen) w.close() main() exit(0)
def main_menu(): global user_text, num_of_players, player_info run = True mode = None while run: # draw all the labels on the screen draw_main_menu() # Refresh the display pygame.display.update() # Checking all events for event in pygame.event.get(): if event.type == pygame.QUIT: return False if event.type == pygame.MOUSEBUTTONDOWN: if len(user_text) > 1: if easy_rect.collidepoint(event.pos): mode = 'easy' if normal_rect.collidepoint(event.pos): mode = 'normal' if hard_rect.collidepoint(event.pos): mode = 'hard' if mode is not None: score = Game.start(user_text, mode, num_of_players, player_info) if score != 0: records.add_to_db(user_text, mode, score) run = secondary_menu.menu(user_text, score, mode, num_of_players, player_info) mode = None if records_rect.collidepoint(event.pos): run = records.records_table() mode = None if settings_rect.collidepoint(event.pos): run, num_of_players, player_info = settings.main( num_of_players, player_info) mode = None if event.type == pygame.KEYDOWN: if len(user_text) < 20: if event.unicode.isalpha() or event.key == pygame.K_SPACE: user_text += event.unicode if event.key == pygame.K_BACKSPACE: user_text = user_text[:-1] pygame.quit()
def main(): #Import import pygame from cursor_menu import Cursor #The Menu Elements import classic #Classic game import settings #settings screen import funky pygame.init() #initialize clock = pygame.time.Clock() #init clock #Colours black = [0, 0, 0] white = [255, 255, 255] #Dimensions width = 800 height = 600 screen = pygame.display.set_mode((width, height)) pygame.display.set_caption("Breakout - Menu") #Make Cursor cursor = Cursor(white, 10, 10) cursor.rect.x = 200 cursor.rect.y = 182 #List all_sprites_list = pygame.sprite.Group() all_sprites_list.add(cursor) #Running Variable running = 1 while (running): #Background Draw screen.fill(black) #Sprites Draw all_sprites_list.draw(screen) #Title Draw font = pygame.font.Font(None, 74) text = font.render("MAIN MENU", 1, white) screen.blit(text, (250, 50)) #Lines Draw font = pygame.font.Font(None, 35) text = font.render("Classic Game", 1, white) # LINE ONE screen.blit(text, (250, 175)) text = font.render("Game With Extras", 1, white) # LINE TWO screen.blit(text, (250, 215)) text = font.render("Settings", 1, white) # LINE THREE screen.blit(text, (250, 255)) pygame.display.flip() #update clock.tick(60) #Main Event Loop for event in pygame.event.get(): #Quit Event if event.type == pygame.QUIT: #press quit button pygame.quit() #Key Down Event elif event.type == pygame.KEYDOWN: if event.key == pygame.K_s: if cursor.rect.y != 262: #Go Down cursor.rect.y += 40 if event.key == pygame.K_w: #Go Up if cursor.rect.y != 182: cursor.rect.y -= 40 if event.key == pygame.K_SPACE: if cursor.rect.y == 262: # Settings settings.main() elif cursor.rect.y == 222: funky.main() elif cursor.rect.y == 182: classic.main() #Move it on to classic
def main(screen): #initilisation phase fps_clock = pygame.time.Clock() end = False story_img = pygame.image.load("Data/Images/Buttons/storybutton.png") rhythm_img = pygame.image.load("Data/Images/Buttons/rhythmbutton.png") battle_img = pygame.image.load("Data/Images/Buttons/battlebutton.png") settings_img = pygame.image.load("Data/Images/Buttons/settingsbutton.png") quit_img = pygame.image.load("Data/Images/Buttons/quitbutton.png") story_rect = story_img.get_rect() rhythm_rect = rhythm_img.get_rect() battle_rect = battle_img.get_rect() settings_rect = settings_img.get_rect() quit_rect = quit_img.get_rect() story_rect.topleft = (80, 270) rhythm_rect.topleft = (80, 375) battle_rect.topleft = (80, 475) settings_rect.topleft = (80, 575) quit_rect.topleft = (80, 675) while 1: #event phase for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() elif event.type == pygame.MOUSEBUTTONDOWN: if story_rect.collidepoint(event.pos): end = 'story' elif rhythm_rect.collidepoint(event.pos): end = 'rhythm' elif battle_rect.collidepoint(event.pos): end = 'battle' elif settings_rect.collidepoint(event.pos): end = 'settings' elif quit_rect.collidepoint(event.pos): sys.exit() #logic phase #render phase screen.fill((0, 0, 0)) # background goes here later screen.blit(story_img, story_rect) screen.blit(rhythm_img, rhythm_rect) screen.blit(battle_img, battle_rect) screen.blit(settings_img, settings_rect) screen.blit(quit_img, quit_rect) pygame.display.flip() fps_clock.tick(60) # navigation phase if end: break if end == 'story': story.main(screen) elif end == 'rhythm': rhythm_selection.main(screen) elif end == 'battle': battle.main(screen) elif end == 'settings': settings.main(screen)
SubPageList = ["欢迎", "仪表盘", "帖子管理", "用户管理", "舆情监测", "设置"] st.title("简书小岛管理平台") active_page = st.sidebar.selectbox("页面", SubPageList) def DebugModeWarning(): if config.DEBUG_MODE == True: debug_warning = st.warning("调试模式已启用") if active_page == "欢迎": DebugModeWarning() welcome.main() elif active_page == "仪表盘": DebugModeWarning() pass elif active_page == "帖子管理": DebugModeWarning() post_manage.main() elif active_page == "用户管理": DebugModeWarning() pass elif active_page == "舆情监测": DebugModeWarning() pass elif active_page == "设置": settings.main()
print('mrr:', mrr0, mrr1, mrr2) print('avg events in session:', df.count().label / dfs.count().label) mask = df.label == 1 print('avg positives in session:', df.label[mask].count() / dfs.count().label) return 0 @settings.main.command(context_settings=dict(allow_extra_args=True, ignore_unknown_options=True)) @click.option('-t', '--task', default='TestPipeline') @click.option('-b', '--batch-size', default=256) @click.option('--name', default='') @click.option('--pipeline-input', default='') @settings.pass_config def pipeline(config: settings.Config): task_handler = task.get(config) task_handler.load_model() task_handler.test_doc_vec() task_handler.test_user_vec() task_handler.test_user_doc_score() task_handler.test_correct() return 0 if __name__ == '__main__': exit(settings.main(auto_envvar_prefix='MSN_NEWS'))
def menu_response(self, widget, event, value=None): if event == 'about': about = Gtk_about_dialog.create(v, APP_PATH) about.run() about.destroy() return if event == 'edit': if sys.platform.startswith('linux'): subprocess.Popen(['xdg-open', CONFIG_PATH]) else: subprocess.Popen(['explorer ', CONFIG_PATH]) return if event == 'fix': global fix_position if fix_position: fix_position = False else: fix_position = True Save_Config() if event == 'sticky': global sticky if sticky: sticky = False self.window.unstick() else: sticky = True self.window.stick() Save_Config() if event == 'setup': settings.main(gw_config_default, gw_config, self.drawing_area, app, icons_list, backgrounds_list) if event == 'redraw_icons': global icons_name icons_name = value #self.drawing_area.redraw(False, False) self.drawing_area.queue_draw() Save_Config() if event == 'redraw_bg': global bg_custom, show_bg_png, color_bg show_bg_png = True if value == 'Нет': show_bg_png = False color_bg = (1, 1, 1, 0) bg_custom = value #self.drawing_area.redraw(False, False) self.drawing_area.queue_draw() Save_Config() if event == 'redraw_text': Load_Color_Scheme(value) self.drawing_area.redraw(False, False) Save_Config() if event == 'reload': # если radio, то обновлялось 2 раза, фикс if type(widget) == gtk.RadioMenuItem: if not widget.get_active(): return global city_id Load_Config() if value != 0: city_id = value.split(';')[0] Save_Config() self.drawing_area.redraw(False) if event == 'edit_city_id': if self.show_edit_dialog(): Save_Config() while gtk.events_pending(): gtk.main_iteration_do(True) self.drawing_area.redraw(False)
""" This project represents an effort to completely recode one of my earliest projects. The original project ran perfectly fine, but as it grew it became more and more unmaintainable. This eventually led to it being abandoned. -Daniel, April 16, 2021. """ import sys import pygame as pg from settings import main if __name__ == '__main__': main() pg.quit() sys.exit()
def main(screen): #initilisation phase fps_clock = pygame.time.Clock() end = False story_img = pygame.image.load("Data/Images/Buttons/storybutton.png") rhythm_img = pygame.image.load("Data/Images/Buttons/rhythmbutton.png") battle_img = pygame.image.load("Data/Images/Buttons/battlebutton.png") settings_img = pygame.image.load("Data/Images/Buttons/settingsbutton.png") quit_img = pygame.image.load("Data/Images/Buttons/quitbutton.png") story_rect = story_img.get_rect() rhythm_rect = rhythm_img.get_rect() battle_rect = battle_img.get_rect() settings_rect = settings_img.get_rect() quit_rect = quit_img.get_rect() story_rect.topleft = (80, 270) rhythm_rect.topleft = (80, 375) battle_rect.topleft = (80, 475) settings_rect.topleft = (80, 575) quit_rect.topleft = (80, 675) while 1: #event phase for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() elif event.type == pygame.MOUSEBUTTONDOWN: if story_rect.collidepoint(event.pos): end = 'story' elif rhythm_rect.collidepoint(event.pos): end = 'rhythm' elif battle_rect.collidepoint(event.pos): end = 'battle' elif settings_rect.collidepoint(event.pos): end = 'settings' elif quit_rect.collidepoint(event.pos): sys.exit() #logic phase #render phase screen.fill((0, 0, 0)) # background goes here later screen.blit(story_img, story_rect) screen.blit(rhythm_img, rhythm_rect) screen.blit(battle_img, battle_rect) screen.blit(settings_img, settings_rect) screen.blit(quit_img, quit_rect) pygame.display.flip() fps_clock.tick(60) # navigation phase if end: break if end == 'story': story.main(screen) elif end == 'rhythm': rhythm_selection.main(screen) elif end == 'battle': battle.main(screen) elif end == 'settings': settings.main(screen)
def settings_menu(): settings.main() homescreen()
def start_settings(): """start the settings function, and return to title screen.""" settings.main(MAIN_GAME_STATE, PICS['menu_background']) choose_function()