def create_main_window(): """ Creates the main window layout. :return: a PySimpleGUI Window object for the main window """ layout = [ [sg.Text("UW-Madison xAPI Data Analyzer", font="Any 15 bold")], [sg.Text("Please select the non-cleaned xAPI data .csv file from the DoIT Learning Locker " "(usually called something like dataMM-DD-YY.csv):")], [sg.In(), sg.FileBrowse(key="FILEIN")], [sg.Text("Please select the DayElement.json file, which contains info on the timedelta and which H5P IDs " "correspond to which days:")], [sg.In(), sg.FileBrowse(key="JSONIN")], [sg.HorizontalSeparator(color="black")], [sg.Text("This program has two modes: it can either get data for certain days (chapters) or for specific H5P " "IDs. Please choose a method and only fill in one of the following text boxes.")], [sg.Text()], [sg.Text("Please enter a comma-separated list of days you would like to get data on, or enter \"all\" to " "have all days with data from the spreadsheet analyzed.")], [sg.InputText(size=(20, 1), key="DAYLIST")], [sg.Text("OR", font="Any 12 bold")], [sg.Text("if you know the exact H5P elements you want data on, please enter a comma-separated list of " "their ID numbers in the box below (leave blank if using above method).")], [sg.InputText(size=(20, 1), key="IDLIST")], [sg.HorizontalSeparator(color="black")], [sg.Text("The data will be saved to the current directory under the folder 'xAPI-Data-Analyzer_$TIMESTAMP/'", font="Any 10 bold")], [sg.Button("Go", size=(4, 1), button_color=("white", "green"))], [sg.HorizontalSeparator(color="black")], [sg.Text("Need help or want to learn more? Check out our GitHub page for an in-depth explanation of the tool:")], [sg.Text("README", font="Any 12 underline bold", text_color="blue", enable_events=True, tooltip="Follow link")] ] return sg.Window("xAPI Data Analyzer", layout, element_justification="center")
def encounter_window(theme): # dodej spodi se search by wing sg.theme(theme) menu_def = [['&Application', ['&About', 'E&xit']]] layout = [[sg.Menu(menu_def)]] layout2 = [[sg.Text("All Compositions:")], [ sg.Listbox(values=list(Compositions.keys()) + list(CustomCompositions.keys()), size=(20, 12), key="COMP_SELECT", enable_events=True, select_mode="LISTBOX_SELECT_MODE_SINGLE") ], [sg.HorizontalSeparator()]] layout3 = [[sg.HorizontalSeparator()], [ sg.Button(button_text="Back", k="Load", size=(13, 2), button_color="orange"), sg.Button(button_text="Select", size=(13, 2), button_color="green") ]] layout += layout2 + layout3 return sg.Window('Gw2-RaidComp Compositions', layout, element_justification="center", font=14)
def create_results_menu(new_zettels, zettels_sans_h, header_level): layout = [] if len(new_zettels.links): layout += [[sg.Text('New zettels:')]] layout += create_zettel_listbox_layout(new_zettels.links, '-new_z-') else: layout += [[sg.Text('No zettels were changed or created.')]] if len(zettels_sans_h.links): layout += [ [sg.HorizontalSeparator(pad=(0, 8))], [ sg.Text( f'Could not find a header of level {header_level} in zettels:' ) ] ] layout += create_zettel_listbox_layout(zettels_sans_h.links, '-z_sans_h-') layout += [[sg.HorizontalSeparator(pad=(0, 8))], [sg.Button('Close', key='-close-')]] return sg.Window('Split zettels', layout)
def new_team_window(theme, x): sg.theme(theme) menu_def = [['&Application', ['&About', 'E&xit']]] layout = [[sg.Menu(menu_def)]] test = [sg.Checkbox(role, k=str(role) + "_box") for role in RoleList] test1 = test[:len(test) // 3] test2 = test[len(test) // 3:2 * len(test) // 3] test3 = test[2 * len(test) // 3:] input_layout = [ [sg.Menu(menu_def)], [sg.Text('Enter player name: '), sg.Input(key='addplayername')], [sg.HorizontalSeparator()], [sg.HorizontalSeparator()], [sg.Text('Select player roles. DPS role is automatically assumed')], test1, test2, test3, [ sg.Button('Cancel', k="Menu", size=(12, 2), button_color="orange"), sg.Text("\t\t\t"), sg.Button('Add player', size=(12, 2), button_color="green") ] ] layout += input_layout return sg.Window('Add Player ' + str(x) + "/10", layout, element_justification="center", font=14)
def layout_main_section(self): """ Return a list of main section emotes. If SEPARATE_GIFS is True, split into static and emoji sections """ main_section = [] statics, gifs = [], [] for img in sorted(IMAGE_PATH.iterdir()): if SHOW_FREQUENTS and img.name in self.frequents: # don't show same image in both sections continue button = sg.Button('', key=img.name, image_filename=img, image_subsample=2, tooltip=img.name) if SEPARATE_GIFS: if img.suffix == '.png': statics.append(button) else: # gif gifs.append(button) else: main_section.append(button) if SEPARATE_GIFS: combined = [] if SHOW_LABELS: combined.append([sg.Text('Images')]) combined.append([sg.HorizontalSeparator()]) combined += self.list_to_table(statics) if SHOW_LABELS: combined.append([sg.Text('GIFs')]) combined.append([sg.HorizontalSeparator()]) combined += self.list_to_table(gifs) return combined return self.list_to_table(main_section)
def new_comp_window(theme): sg.theme(theme) menu_def = [['&Application', ['&About', 'E&xit']]] layout = [[ sg.Text('Add new composition', size=(38, 1), justification='center', font=("Helvetica", 24), relief=sg.RELIEF_RIDGE) ]] # k = event layout2 = [[sg.Menu(menu_def)]] test1 = [ sg.Spin([i for i in range(0, 11)], initial_value=0, k=str(role) + "_SPIN", size=(5, 20)) for role in RoleList ] test2 = [sg.Text(role) for role in RoleList] test = [i for t1t2 in zip(test2, test1) for i in t1t2] test1 = test[:len(test) // 3] test2 = test[len(test) // 3:2 * len(test) // 3] test3 = test[2 * len(test) // 3:] input_layout = [ [sg.Menu(menu_def)], [sg.Text('Enter composition name:')], [sg.Input(key='addcompname')], [sg.HorizontalSeparator()], [sg.HorizontalSeparator()], [ sg.Text( 'Select number of players for each role. The remaining will be filled with DPS' ) ], test1, test2, test3, [ sg.Button('Back', key='Compositions', size=(12, 2), button_color="orange"), sg.Text("\t\t"), sg.Button('Save', size=(12, 2), button_color="green") ] ] layout += input_layout + layout2 return sg.Window('Gw2-RaidComp Compositions', layout, element_justification="center", font=14)
def menu_window(theme): sg.theme(theme) menu_def = [['&Application', ['&About', 'E&xit']]] input_layout = [ [sg.Menu(menu_def)], [ sg.Button(button_text="Compositions", size=(13, 2), button_color="white") ], [sg.HorizontalSeparator()], [sg.Text('Choose mode:')], [ sg.Button(button_text="Pug Commander", size=(15, 3)), sg.Text("\t\t\t "), sg.Button(button_text="Static Commander", size=(15, 3)) ], ] layout = [[ sg.Text('MENU', size=(38, 1), justification='center', font=("Helvetica", 24), relief=sg.RELIEF_RIDGE) ]] # k = event layout += input_layout return sg.Window('Gw2-RaidComp Menu', layout, element_justification="center", font=14)
def create_check_media_menu(broken_link_z, unused_assets, z_sans_ID, untitled_z, untagged_z): tab_list = [] if len(unused_assets): layout = create_asset_table_layout(unused_assets, '-unused_assets-') tab_list += [sg.Tab('Unused assets', layout)] if len(broken_link_z): layout = create_zettel_listbox_layout(broken_link_z.links, '-broken_links-') layout += [[sg.Text('These buttons are for the zettels that contain the broken asset links.')]] tab_list += [sg.Tab('Broken asset links', layout)] if len(z_sans_ID): layout = create_zettel_listbox_layout(z_sans_ID.links, '-z_sans_ID-') tab_list += [sg.Tab('Zettels without IDs', layout)] if len(untitled_z): layout = create_zettel_listbox_layout(untitled_z.links, '-untitled_z-') tab_list += [sg.Tab('Zettels without titles', layout)] if len(untagged_z): layout = create_zettel_listbox_layout(untagged_z.links, '-untagged_z-') tab_list += [sg.Tab('Zettels without tags', layout)] layout = [] if len(tab_list) == 0: layout = [[sg.Text('All\'s well.')], [sg.Text('Could not find any unused assets, broken asset links,')], [sg.Text('or zettels without IDs, titles, or tags.')]] else: layout += [[sg.TabGroup([tab_list])]] layout += [[sg.HorizontalSeparator(pad=(0, 8))], [sg.Button('Close', key='-close-')]] return sg.Window('Check media', layout)
def settings_window(mandatory: bool, config: Dict[str, str]) -> sg.Window: """Settings configuration window. Args: mandatory: Whether if previous settings were invalid or not. If True, Exit button is showed instead of Cancel. config: Default input text fields. """ layout = [ [sg.T("Token*", tooltip="Clash Royale API token (mandatory)")], [sg.In(config["token"] or "", key="in.token")], [ sg.T("Player tag", tooltip="Your personal player tag (optional)") ], [sg.In(config["player_tag"] or "", key="in.player_tag")], [sg.T("Clan tag", tooltip="Your clan tag (optional)")], [sg.In(config["clan_tag"] or "", key="in.clan_tag")], [sg.T("Theme")], [ sg.Combo( THEMES.split("|"), default_value=config["theme"], key="cmb.theme", enable_events=True, ) ], [ sg.Save(), sg.Exit() if mandatory else sg.Cancel(), sg.HorizontalSeparator(), sg.B("Preview theme"), ], ] return sg.Window(TITLE, layout)
def layout_gui(self): """ Layout GUI, then build a window and hide it """ print('loading layout...') self.layout = [] if SHOW_FREQUENTS: if SHOW_LABELS: self.layout.append([ sg.Text('Frequently Used'), sg.Button('Hide', button_color=('black', 'orange')) ]) self.layout.append([sg.HorizontalSeparator()]) self.layout += self.layout_frequents_section() self.layout += self.layout_main_section() if self.window: # close old window before opening new (for rebuilds) self.window.close() no_titlebar = SYSTEM == 'Windows' self.window = sg.Window('Emote Picker', self.layout, location=self.window_location, keep_on_top=True, no_titlebar=no_titlebar, grab_anywhere=True, finalize=True) if SYSTEM == 'Darwin': # Mac hacky fix for blank hidden windows # read the window once, allows for hiding self.window.read(timeout=10) self.hide_gui() print('ready - window created and hidden')
def choose_static_window(theme, TeamData): sg.theme(theme) menu_def = [['&Application', ['&About', 'E&xit']]] layout = [[sg.Menu(menu_def)], [ sg.Text('Static Commander', size=(38, 1), justification='center', font=("Helvetica", 24), relief=sg.RELIEF_RIDGE) ]] # k = event tempstring = ", ".join(Compositions.keys()) layout2 = [[sg.Text("Choose one of your groups")], [ sg.Listbox(values=list(TeamData.keys()), size=(20, 15), key="TEAM", enable_events=True, select_mode="LISTBOX_SELECT_MODE_SINGLE"), sg.Output(size=(70, 15), key="OUTPUT_TEAM", echo_stdout_stderr=False) ], [sg.HorizontalSeparator()]] layout3 = [[sg.HorizontalSeparator()]] # se customly dodane layout4 = [[ sg.Button(button_text="Back", key="Menu", size=(13, 2), button_color="orange"), sg.Text(" "), sg.Button(button_text="Delete", k="DeleteTeam", size=(13, 2), button_color="gray"), sg.Text(" "), sg.Button(button_text="Add", size=(13, 2), button_color="white"), sg.Text("\t\t "), sg.Button(button_text="Load", size=(13, 2), button_color="green") ]] layout += layout2 + layout3 + layout4 return sg.Window('Gw2-RaidComp Static', layout, font=14)
def _divider(direction, line_color='#283B5B'): '''docstring for _divider''' if direction == 'h': line = sg.HorizontalSeparator(color=line_color) else: line = sg.VerticalSeparator(color=line_color) return line
def make_town_news_window(): # Get the web data town_news = scrape.parse_edison_news() # Variable to hold the constructed GUI elements town_news_content = [] # For each story from the town news page, append the story text and # a separator. for story in town_news: town_news_content.append([sg.Text(story['text'], size=(100, None))]) town_news_content.append([sg.HorizontalSeparator()]) # Variable containing the total layout for the page. Combines the generic # layouts from the CL_layouts file and the window specific layouts. layout = [ layouts.create_top_banner(back_button=True), [ sg.Column([[ sg.Column([[sg.Text('Edison', font='Any 16')]], expand_x=True), sg.Column([[ sg.Button('News'), sg.Button('Dept. Info'), sg.Button('Town Meeting Info') ]]) ]], expand_x=True) ], [ sg.Column([[ sg.Text('Edison Township News', font='Any 18', background_color=DARK_HEADER_COLOR) ]], background_color=DARK_HEADER_COLOR, expand_x=True) ], [ sg.Column(town_news_content, expand_x=True, expand_y=True, scrollable=True, vertical_scroll_only=True, vertical_alignment='top', size=(540, 300)) ], layouts.create_footer() ] # Return a window object containing the finalized layout. return sg.Window('Get Involved NJ - Town Information', layout, size=(720, 540), finalize=True, margins=(0, 0), background_color=BORDER_COLOR, no_titlebar=False, grab_anywhere=False)
def layout_gui(self): """ Layout GUI with PySimpleGui """ self.layout = [] if SHOW_FREQUENTS: if SHOW_LABELS: self.layout.append([sg.Text('Frequently Used')]) self.layout += self.layout_frequents_section() self.layout.append([sg.HorizontalSeparator()]) self.layout += self.layout_main_section()
def rename_window(old_name, theme=None, par_centre=(None, None)): sg.theme(theme) layout = [[sg.Text("Rename Campaign - " + old_name)], [sg.HorizontalSeparator(color="gray")], [ sg.Text("New name"), sg.InputText("", size=(25, 1), key="campaign_name") ], [sg.Button("Confirm"), sg.Button("Cancel")]] window = sg.Window("Rename", layout, finalize=True, icon=icon_path, element_justification="center", disable_minimize=False, return_keyboard_events=True, alpha_channel=0) window_centre(window, par_centre) while True: event, values = window.read() wanted_event = True focused_enter = None # print(event) if event in ('\r', QT_ENTER_KEY1, QT_ENTER_KEY2): active_element = window.FindElementWithFocus( ) #Dectects if the enter key has been pressed and checks which element is active print(active_element) if active_element == window["campaign_name"]: focused_enter = "campaign_name" if event == sg.WIN_CLOSED or event == "Cancel": window.close() return elif event == "Confirm" or focused_enter == "campaign_name": name = window["campaign_name"].Get() if name != "" and name not in listdir(): window.close() return name else: if name in listdir(): window.disable() alert_box( text="Campaign \"{}\" already exists".format(name), theme=theme, par_centre=par_centre) window.enable() pass else: wanted_event = False if wanted_event == True: window.force_focus()
def __init__(self, title, master, *args, **kwargs): self.master = master self.model = KitchenModel.getInstance() self.recipeBox = sg.Multiline( key='-VIEWER-BOX-', size=(80, 30), tooltip= "Recipes will be displayed here when they are selected on the recipe table tab." ) self.export = sg.Button( 'Export File', key='-VIEWER-EXPORT-', tooltip= "This button causes a prompt to display that will allow you to create a recipe file", disabled=True) self.share = sg.Button( 'Share', key='-VIEWER-SHARE-', disabled=True, tooltip= "This button will allow you to quickly share recipes with friends - Not In Use" ) self.multby = sg.Combo(values=[f'{i}' for i in np.arange(.5, 5, .5)], key='-VIEWER-MULTBY-', enable_events=True, default_value='1', disabled=True) layout = [ [ sg.Button( 'Print', key='-VIEWER-PRINT-', disabled=True, tooltip= "This button will let you print the currently selected recipe" ), self.export, self.share, sg.Button('Edit', key='-VIEWER-EDIT-', tooltip="Click here to edit this recipe", disabled=True), sg.T('Multiply By:'), self.multby ], [self.recipeBox], [sg.HorizontalSeparator()], [ sg. T('Nutrition', tooltip= "This area will be filled with Nutrition info about the recipe - Not In Use" ) ] ] super().__init__(title, layout=layout, *args, **kwargs) # self.controller = recipeViewerController(self.recipeBox) self.model.addTab("-VIEWER-", self, recipeViewerController(), {"recipeBox": self.recipeBox})
def start_layout(): # Start layout layout = [[sg.Text('Field height'), sg.InputText('8', key='playfield_h', size=(5, 1)), sg.Text('Field width'), sg.InputText('8', key='playfield_w', size=(5, 1)), sg.Text('Mines count'), sg.InputText('10', key='mines_count', size=(5, 1))], [sg.HorizontalSeparator()], [sg.Column([[sg.Button(button_text='Start game', key='grid')]]), sg.Column([[sg.Cancel('Exit')]], element_justification='right', expand_x=True)] ] return layout
def create_layout(mines_count, playfield_h, playfield_w, grid_for_player, grid_for_nn): # Layout for next games layout = [[sg.Text('Field height'), sg.InputText(f'{playfield_h}', key='playfield_h', size=(5, 1)), sg.Text('Field width'), sg.InputText(f'{playfield_w}', key='playfield_w', size=(5, 1)), sg.Text('Mines count'), sg.InputText(f'{mines_count}', key='mines_count', size=(5, 1))], [sg.HorizontalSeparator()], [sg.Column([[sg.Text('Player', key='pl_field', size=(25, 1))], [grid_for_player], [sg.Checkbox('Save player results', default=True, key='save_pl')]]), sg.HorizontalSeparator(), sg.Column([[sg.Text('Neural network', key='nn_field', size=(25, 1))], [grid_for_nn], [sg.Checkbox('Save NNet results', default=True, key='save_nn')]])], [sg.HorizontalSeparator()], [sg.Column([[sg.Button(button_text='Start game', key='grid'), sg.Button(button_text='Save results', key='save'), sg.Button(button_text='Complete', key='complete')]]), sg.Column([[sg.Cancel('Exit')]], element_justification='right', expand_x=True)], [sg.Text('* Results folder - minesweeper_directory/results/')], [sg.Text('** If You losed before neural net, just press "Complete" button')] ] return layout
def __init__(self): threading.Thread.__init__(self) self.model=torch.load('model\\test_model100.m',map_location=torch.device('cpu')) self.img_path='data\grab1.png' self.img_dealer_path='data\grab_dealer.png' self.img_player_path='data\grab_player.png' self.model.eval() self.list=[] self.hit=[sg.Text('x'),sg.In(size=(5,1),enable_events=True,key='hit_x'),sg.Text('y'),sg.In(size=(5,1),enable_events=True,key='hit_y'),sg.Radio(text='hit',group_id='check',enable_events=False,key='hit_check')] self.stand=[sg.Text('x'),sg.In(size=(5,1),enable_events=True,key='stand_x'),sg.Text('y'),sg.In(size=(5,1),enable_events=True,key='stand_y'),sg.Radio(text='stand',group_id='check',enable_events=False,key='stand_check')] self.split=[sg.Text('x'),sg.In(size=(5,1),enable_events=True,key='split_x'),sg.Text('y'),sg.In(size=(5,1),enable_events=True,key='split_y'),sg.Radio(text='split',group_id='check',enable_events=False,key='split_check')] self.double=[sg.Text('x'),sg.In(size=(5,1),enable_events=True,key='double_x'),sg.Text('y'),sg.In(size=(5,1),enable_events=True,key='double_y'),sg.Radio(text='double',group_id='check',enable_events=False,key='double_check')] self.deal=[sg.Text('x'),sg.In(size=(5,1),enable_events=True,key='deal_x'),sg.Text('y'),sg.In(size=(5,1),enable_events=True,key='deal_y'),sg.Radio(text='deal',group_id='check',enable_events=False,key='deal_check')] self.extra1=[sg.Text('x'),sg.In(size=(5,1),enable_events=True,key='extra1_x'),sg.Text('y'),sg.In(size=(5,1),enable_events=True,key='extra1_y'),sg.Radio(text='extra1',group_id='check',enable_events=False,key='extra1_check')] self.extra2=[sg.Text('x'),sg.In(size=(5,1),enable_events=True,key='extra2_x'),sg.Text('y'),sg.In(size=(5,1),enable_events=True,key='extra2_y'),sg.Radio(text='extra2',group_id='check',enable_events=False,key='extra2_check')] self.start_end_XY_Radio=[sg.Radio(text='grab area',group_id='grab_check',enable_events=False,key='grab_check')] self.start_end_Y=[sg.Text('start x'),sg.In(size=(5,1),enable_events=True,key='mouse_x_start'),sg.Text('end x'),sg.In(size=(5,1),enable_events=True,key='mouse_x_end')] self.start_end_X=[sg.Text('start y'),sg.In(size=(5,1),enable_events=True,key='mouse_y_start'),sg.Text('end y'),sg.In(size=(5,1),enable_events=True,key='mouse_y_end')] self.separator=[sg.HorizontalSeparator()] self.image_window = [sg.Image(filename="data\MatejkoKonst3Maj1791.png",background_color='white',enable_events=True,size=(300,300),key='_image_')] self.column_1=[ self.start_end_XY_Radio, self.start_end_Y, self.start_end_X, self.separator, [sg.Text('in text'), sg.In(size=(25, 1),enable_events=False,key='in')], [sg.Button('grab',key='_grab_'),sg.Button('calc',key='_calc_'),sg.Button('remove',key='_remove_') ], [sg.Listbox(values=self.list,enable_events=True,size=(30,10), key='_list_',auto_size_text=True)] ] # self.column_3 = [ # , # [sg.Text('out text '), sg.In(size=(25, 1),enable_events=True,key='out')], # [sg.Text('extra '), sg.In(size=(25, 1),enable_events=True,key='extra')], # ] self.column_2 = [ self.image_window ] self.layout = [ [sg.Column(self.column_1),sg.Column(self.column_2,key='column_2')] ] self.window = sg.Window('BlackJack',self.layout,resizable=True) self.keyboard_listener=KeyboardListener(on_press=self.on_press, on_release=self.on_release) self.mouse_listener = MouseListener(on_move=self.on_move, on_click=self.on_click,onscroll=self.on_scroll) self.mouse = Controller() self.mouse_button = Button self.keyboard = Controller()
def test_window(theme=None, par_centre=(None, None)): sg.theme(theme) # c1=[sg.Button("Confirm"), sg.Button("Cancel")] layout = [ [sg.Text("test")], [sg.HorizontalSeparator(color="gray")], [ sg.Text("New name"), sg.InputText("", size=(25, 1), key="campaign_name") ], #[sg.Button("Confirm"), sg.Button("Cancel")], [ sg.Listbox([ "aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee", "fffff", "ggggg", "hhhhh" ], size=(15, 6), key="list") ], [sg.Button("x"), sg.Button("y")] ] window = sg.Window("test", layout, finalize=True, icon=icon_path, element_justification="center", disable_minimize=False, alpha_channel=0) window_centre(window, par_centre) #event, values = window.read(timeout = 0) window.move(0, 0) #sleep(1) # window.reappear() i, j = 0, 0 while True: event, values = window.read() wanted_event = True if event == sg.WIN_CLOSED: break elif event == "x": window.move(i, j) i += 20 j += 20 else: wanted_event = False if wanted_event == True: window.force_focus() window.close()
def create_img_win(): img_col_l = [[sg.Text('Share A')], [sg.Image(key='-SHARE_A-')], [sg.Text('Share B')], [sg.Image(key='-SHARE_B-')]] img_col_r = [[sg.Text('Share A+B'), sg.Image(key='-SHARE_AB-')]] img_layout = [ [sg.Col(img_col_l), sg.VerticalSeparator(), sg.Col(img_col_r)], [sg.HorizontalSeparator(pad=None)], ] win = sg.Window('Images', img_layout) return win
def __init__(self, fspath=None, *, tagger): self._fspath = fspath self.tagger = tagger # path->set(suggested_tags) self._suggested_tags = {} # tag_name->TagWidget self._tag_widgets = {} self.preview = ImageWidget( key="preview", fixed_size=(1920, 1080), background_color='grey', expand_x=True, ) self.tagsview = TagsView( key="tags", fixed_size=(1920, 200), background_color='blue', expand_x=True, get_tag_widget=lambda tag: self._tag_widget(tag.name), ) layout = [ [ sg.Column( [ [self.preview], [sg.HorizontalSeparator()], [sg.Text("tags view")], [self.tagsview], [sg.HorizontalSeparator()], [sg.Text("bottom")], ], size=(1920, 1600), ) ] ] super().__init__(fspath or "NONE", layout)
def make_window(): """ Creates the main window :return: The main window object :rtype: (Window) """ theme = sg.user_settings_get_entry('-theme-') demo_files, git_files = get_demo_git_files() sg.theme(theme) # First the window layout...2 columns find_tooltip = "Find in file\nEnter a string in box to search for string inside of the files.\nFile list will update with list of files string found inside." filter_tooltip = "Filter files\nEnter a string in box to narrow down the list of files.\nFile list will update with list of files with string in filename." left_col = [ [sg.Text('Demo Programs', font='Any 20')], [sg.Listbox(values=demo_files, select_mode=sg.SELECT_MODE_EXTENDED, size=(40, 20), key='-DEMO LIST-')], [sg.Text('Filter:', tooltip=filter_tooltip), sg.Input(size=(25, 1), enable_events=True, key='-FILTER-', tooltip=filter_tooltip)], [sg.Button('Run'), sg.Button('Copy'), sg.B('Edit')], [sg.Text('Find:', tooltip=find_tooltip), sg.Input(size=(25, 1), enable_events=True, key='-FIND-', tooltip=find_tooltip)], ] right_col = [ [sg.Text('GitHub Demo Programs', font='Any 20')], [sg.Listbox(values=git_files, select_mode=sg.SELECT_MODE_EXTENDED, size=(40, 20), key='-GIT DEMO LIST-')], [sg.Button('Run', key='Run Git Version')], ] # ----- Full layout ----- ML_KEY = '-ML-' # Multline's key layout = [[sg.vtop(sg.Column(left_col, element_justification='c')), sg.VSeperator(), sg.vtop(sg.Column(right_col, element_justification='c'))], [sg.HorizontalSeparator()], [sg.Multiline(size=(90, 10), write_only=True, key=ML_KEY, reroute_stdout=True, echo_stdout_stderr=True)], [sg.Combo(sg.user_settings_get_entry('-filenames-', []), default_value=sg.user_settings_get_entry('-last filename-'), size=(65, 1), k='-FILENAME-'), sg.FileBrowse(), sg.B('Clear'), sg.B('Run', k='-RUN INDIVIDUAL-'), sg.B('Edit', k='-EDIT INDIVIDUAL-')], [sg.Button('Edit Me (this program)'), sg.B('Launch GitHub', button_color=(sg.theme_input_background_color(), sg.theme_input_text_color())), sg.Button('Exit'), sg.B('Settings')], ] # --------------------------------- Create Window --------------------------------- window = sg.Window('GitHub Demo Copier', layout, icon=icon) sg.cprint_set_output_destination(window, ML_KEY) return window
def create_split_menu(zettel_links): layout = [[ sg.Combo(['#', '##', '###', '####', '#####', '######'], key='-header_level-', default_value='####', size=(8, 20), pad=(5, 15), readonly=True), sg.Text('Header level to split by') ], [sg.Text('Zettels with the tag "#split":') ], [sg.Listbox(zettel_links, size=(80, 6), key='-zettels_to_split-')], [ sg.Button('Split all', key='-split_all-'), sg.Button('Split selected', key='-split_selected-') ], [sg.HorizontalSeparator(pad=(0, 8))], [sg.Cancel()]] return sg.Window('Split zettels', layout)
def pug_window(theme): sg.theme(theme) menu_def = [['&Application', ['&About', 'E&xit']]] input_layout = [ [sg.Menu(menu_def)], [ sg.Text('daring today are we?', size=(40, 5), justification="center") ], [sg.HorizontalSeparator()], [ sg.Button(button_text="1", size=(15, 3)), sg.Text("\t"), sg.Button(button_text="2", size=(15, 3)), sg.Text("\t"), sg.Button(button_text="3", size=(15, 3)), sg.Text("\t"), sg.Button(button_text="4", size=(15, 3)) ], [ sg.Button(button_text="5", size=(15, 3)), sg.Text("\t"), sg.Button(button_text="6", size=(15, 3)), sg.Text("\t"), sg.Button(button_text="7", size=(15, 3)), sg.Text("\t"), sg.Button(button_text="8?!?", key="8", size=(15, 3)) ], ] layout = [[ sg.Text('Choose wing:', size=(38, 1), justification='center', font=("Helvetica", 24), relief=sg.RELIEF_RIDGE) ]] # k = event layout += input_layout return sg.Window('Gw2-RaidComp Menu', layout, element_justification="center", font=14)
def startTreasureHuntUi(self): global moduleWindow self.treasureBotInitialisation() sg.theme('TreasureHunt') botLayout = [ [ sg.Button(image_filename=imgList['on'], button_color=(sg.theme_background_color( ), sg.theme_background_color()), border_width=0, key="ON/OFF", pad=(10, 0)), sg.Button(image_filename=imgList['exit'], button_color=(sg.theme_background_color( ), sg.theme_background_color()), border_width=0, key='EXIT', image_size=(30, 30)) ], [sg.Text("Position info", key="POS", font=('Helvetica', 15, 'bold'))], [sg.HorizontalSeparator()], [sg.Image(filename=imgList['noDirection'], key="DIRECTION")], [sg.Button(image_filename=imgList['placeHolder'], button_color=( sg.theme_background_color(), sg.theme_background_color()), border_width=0, key="IMAGE")] ] moduleWindow = sg.Window( title="Treasure Hunt Helper", no_titlebar=True, grab_anywhere=True, layout=botLayout, margins=(0, 0), border_depth=3, keep_on_top=True, finalize=True, alpha_channel=.85, element_justification=CENTER) while True: event, values = moduleWindow.read(timeout=15000) if event == "IMAGE": if self.found is not None: self.clickNextStep() elif event == "ON/OFF": self.load() elif (event == sg.WIN_CLOSED) or (event == "EXIT"): self.stop() break moduleWindow.refresh() moduleWindow.close()
def mainframe(): #read from file into dictionary read_all_passwords() #set layout of overlay layout = [ [ui.B("Show all Passwords", key="-ALLPW-", font = ('AppleGothic',12)), #button to print passwords ui.B("Search for Password",key="-SEARPW-", font = ('AppleGothic',12)), #button to search for password and print it ui.B("Add Password",key="-ADDPW-", font = ('AppleGothic',12)), #button to add a password ui.B("Delete Password",key="-DELPW-", font = ('AppleGothic',12)), #button to delete a featured password ui.B("EXIT", font = ('AppleGothic',12))], #button to exit program [ui.HorizontalSeparator()], #add a seperator [ui.Multiline(size=(70,30),key="-OUT-",do_not_clear=False,font=('AppleGothic', 14))] #multiline to print results ] #create window window = ui.Window("Manager", layout) #event loop while True: #read window event,values = window.read() if event == "EXIT" or event == ui.WIN_CLOSED: #if window is closed or cancel is pressed break #break loop if event == "-ALLPW-": #if all passwords are searched read_all_passwords() #update the dictionary for x in keys: #print loop fr all keys print_result(x,window) #print key and value pair if event == "-SEARPW-": #Search PW Button pressed result_sear = search_password() #asign search result to result if result_sear == 0: #if the search is canceled or a failure occured continue #continue the loop else: print_result(result_sear,window) #print the result of the search if event =="-ADDPW-": #Add PW Button pressed result_add = add_password() #asign result of add_password to result_add if result_add == 0: #if adding is canceled continure continue if event =="-DELPW-": #if delete is pressed result_del = delete_password() #asign result of delete_password to result_del read_all_passwords() #refresh the dictionary if result_del == 1: for x in keys: #print loop fr all keys print_result(x,window) #print key and value pair if result_del == 0: #if deletion is canceled continue continue
def lfg_generator_window(theme, wingnumber): sg.theme(theme) menu_def = [['&Application', ['&About', 'E&xit']]] input_layout = [[sg.Menu(menu_def)], [sg.Text(notes[wingnumber])], [sg.HorizontalSeparator()]] layout = [[ sg.Text('Recommended comps:', size=(38, 1), justification='center', font=("Helvetica", 24), relief=sg.RELIEF_RIDGE) ]] # k = event layout += input_layout return sg.Window('Gw2-RaidComp Menu', layout, element_justification="center", font=14)
def create_layout(full=True): menu_def = [['File', ['Open...', 'Save', 'Save As...', 'Exit']], ['Advanced', ['Toggle Hidden Fields']]] mat_combo = [] for i in range(len(materials)): mat_combo.append( f'{i} - [File Offset: 0x{materials[i].at(0).offset:X}]') entry_keys.clear() if full: for i in range(39): entry_keys.append(f'-ENTRY{i}-') else: for i in range(37): if i in { 9, 10, 11, 12, 13, 14, 15, 16, 20, 21, 22, 24, 25, 26, 28, 29, 30, 35, 36, 37, 38 }: entry_keys.append(f'-ENTRY{i}-') else: entry_keys.append(None) combo = sg.Combo(mat_combo, mat_combo[current_mat], change_submits=True, readonly=True, key='-MATSELECT-', size=(25, 1)) layout = [[sg.Menu(menu_def)], [ sg.Text('Current Material: '), combo, sg.Text('* Hover over field names for explanatory tooltip') ], [sg.HorizontalSeparator(pad=(0, 8))]] if full: layout = full_layout(layout) else: layout = small_layout(layout) return layout
def make_window2(): layout = [ [sg.Text(size=(40, 1), key="-WIN2-")], [sg.Text(size=(40, 3), key='-OUTPUT-')], [sg.HorizontalSeparator()], [ sg.Text("Compare recommendations for User ID:"), sg.InputText(size=(6, 1), key="-USERID-") ], [ sg.Text("Note: User id should be from the test set", text_color="#777777", font='Default 12') ], [sg.Button("Compare", key="-COMPARE-")], [sg.Text("Recommendations based on")], [ sg.Text("Real ratings:"), sg.Text( " Predicted ratings:" ) ], [ sg.Table(values=[], headings=['User ID', 'Product ID', 'Rating'], display_row_numbers=True, auto_size_columns=False, key="-RLIST-"), sg.Table(values=[], headings=['User ID', 'Product ID', 'Predicted Rating'], display_row_numbers=True, auto_size_columns=False, key="-PLIST-") ], [sg.Button('Back', key="Exit")], ] return sg.Window('System Evaluation', layout, font='Default 14', finalize=True)