def gui(): """GUI form for choosing packages to upload to DeployPyPi.""" # Get most recent deployment data most_recent = most_recent_history(DOCKER_HISTORY_JSON) sg.SetOptions(text_justification='left') # Set parameter values most_recent['source'] = most_recent.get('source', '') most_recent['docker_user'] = most_recent.get('docker_user', '') most_recent['docker_repo'] = most_recent.get('docker_repo', '') most_recent['docker_repo_tag'] = most_recent.get('docker_repo_tag', '') # Local directory settings directory_settings = [ # Source [ sg.FolderBrowse('Source', size=(LABEL_COL_WIDTH, 1), font='Any {0}'.format(BODY_FONT_SIZE)), sg.In(default_text=most_recent['source'], size=(INPUT_COL_WIDTH, 1), key='source', font='Any {0}'.format(16)) ] ] # DockerHub settings docker_hub_settings = [ # Username [ sg.Text('Username', size=(LABEL_COL_WIDTH, 1), font='Any {0}'.format(BODY_FONT_SIZE)), sg.In(default_text=most_recent.get('docker_user', ''), size=(INPUT_COL_WIDTH, 1), key='docker_user') ], # Repo [ sg.Text('Repository', size=(LABEL_COL_WIDTH, 1), font='Any {0}'.format(BODY_FONT_SIZE)), sg.In(default_text=most_recent.get( 'docker_repo', most_recent.get('aws_environment-name', '')), size=(INPUT_COL_WIDTH, 1), key='docker_repo') ], # Tag [ sg.Text('Tag', size=(LABEL_COL_WIDTH, 1), font='Any {0}'.format(BODY_FONT_SIZE)), sg.In(default_text=most_recent.get('docker_repo_tag', ''), size=(INPUT_COL_WIDTH, 1), key='docker_repo_tag') ], # Host Port [ sg.Text('Host Port', size=(LABEL_COL_WIDTH, 1), font='Any {0}'.format(BODY_FONT_SIZE)), sg.In(default_text=most_recent.get('host_port', HOST_PORT), size=(INPUT_COL_WIDTH, 1), key='host_port') ], # Container Port [ sg.Text('Container Port', size=(LABEL_COL_WIDTH, 1), font='Any {0}'.format(BODY_FONT_SIZE)), sg.In(default_text=most_recent.get('container_port', CONTAINER_PORT), size=(INPUT_COL_WIDTH, 1), key='container_port') ], # Dockerfile [ sg.Text('Dockerfile path (relative to source)', size=(LABEL_COL_WIDTH, 1), font='Any {0}'.format(BODY_FONT_SIZE)), sg.In(default_text=most_recent.get('dockerfile', 'Dockerfile'), size=(INPUT_COL_WIDTH, 1), key='dockerfile') ], # Another deployment? [ sg.Checkbox('Deploy another environment?', size=(LABEL_COL_WIDTH * 2, 2), default=False, key='another_deploy') ] ] # Deployable project options commands = [[ sg.Checkbox(cmd.capitalize(), size=(LABEL_COL_WIDTH, 1), default=False if not cmd.startswith('build') else True, key='action_' + cmd) for cmd in ('build', 'push', 'run', 'push-latest') ], [ sg.Checkbox('build-cache'.capitalize(), size=(LABEL_COL_WIDTH, 1), default=True, key='action_build-cache') ]] # Create form layout layout = [[ sg.Frame('Directory settings', directory_settings, title_color='green', font=DEFAULT_FONT) ], [ sg.Frame('DockerHub settings', docker_hub_settings, title_color='blue', font=DEFAULT_FONT) ], [ sg.Frame('Docker commands', commands, title_color='blue', font=DEFAULT_FONT) ], [sg.Submit(), sg.Cancel()]] window = sg.FlexForm('Docker Hub Deployment Control', font=("Helvetica", HEADER_FONT_SIZE)) window.Layout(layout) while True: button, values = window.ReadNonBlocking() if button is 'Submit': # Pack keys with 'action' prefix into a new 'actions' key values['actions'] = { key.replace('action_', ''): values.pop(key) for key in list(values.keys()) if key.startswith('action_') } return values elif button is 'Cancel': exit()
# -*- encoding: utf-8 -*- import PySimpleGUI as sg # Very basic window. Return values as a list layout = [[sg.Text('Please enter your Name, Address, Phone')], [sg.Text('Name', size=(15, 1)), sg.InputText()], [sg.Text('Address', size=(15, 1)), sg.InputText()], [sg.Text('Phone', size=(15, 1)), sg.InputText()], [sg.Submit(), sg.Cancel()]] window = sg.Window('Simple data entry window').Layout(layout) event, values = window.Read() window.Close() print(event, values[0], values[1], values[2])
def main(): menu_def = [[ 'Mode', ['auto', 'manual', 'check_HST_t', 'upload_HST_t', 'add_HST_arch'], ], [ 'READ', [ 'rd_term_FUT', 'rd_term_HST', '---', 'rd_data_FUT', 'rd_hst_FUT_t', ], ], [ 'UPDATE', [ 'update_cfg_SOFT', 'update_data_FUT', 'update_data_HST', ], ], [ 'PRINT', [ 'prn_cfg_SOFT', '---', 'prn_ar_FILE', 'prn_hist_in_FILE', '---', 'prn_data_FUT', '---', 'prn_hst_FUT_t', 'prn_arr_FUT_t', ], ], ['Exit', 'Exit']] while True: # init db_TODAY --------------------------------------- #sg.theme('LightGreen') #sg.set_options(element_padding=(0, 0)) c_dir = os.path.abspath(os.curdir) db_TODAY = Class_DB(c_dir + '\\DB\\db_fut_t.sqlite', c_dir + '\\DB\\db_fut_a.sqlite') lg_FILE = Class_LOGGER(c_dir + '\\LOG\\fut_logger.log') lg_FILE.wr_log_info('START') rq = db_TODAY.op( rd_cfg_SOFT=True, update_data_FUT=True, update_data_HST=True, rd_hst_FUT_t=True, ) if rq[0] != 0: #prn_rq('INIT rd_cfg_SOFT TODAY', rq) print('INIT = > ', rq[1]) else: print('INIT cfg_term_data_hist TODAY = > ', rq) break while True: # init MENU ------------------------------------------- def_txt, frm = [], '{: <10} => {: ^15}\n' def_txt.append(frm.format('db_today', '\\DB\\db_today.sqlite')) def_txt.append(frm.format('db_archv', '\\DB\\db_archv.sqlite')) #======================================================================= # Display data layout = [ [sg.Menu(menu_def, tearoff=False, key='menu_def')], [ sg.Multiline(default_text=''.join(def_txt), size=(50, 5), key='txt_data', autoscroll=False, focus=False), ], [ sg.T('', size=(60, 2), font='Helvetica 8', key='txt_status'), #sg.Quit(auto_size_button=True) ], ] sg.SetOptions(element_padding=(0, 0)) window = sg.Window(db_TODAY.titul, grab_anywhere=True).Layout(layout).Finalize() window.FindElement('txt_data').Update(''.join(def_txt)) break tm_out, mode, frm = 360000, 'manual', '%d.%m.%Y %H:%M:%S' stts = time.strftime(frm, time.localtime()) + '\n' + 'event = manual' window.FindElement('txt_status').Update(stts) win_CFG_active = False win_UPD_active = False while True: # MAIN cycle ------------------------------------------ stroki = [] event, values = window.Read(timeout=tm_out) #--------------------------------------------------------------- event_menu(event, db_TODAY) #--------------------------------------------------------------- if event is None or event == 'Quit' or event == 'Exit': break #--------------------------------------------------------------- if event == 'auto': tm_out, mode = 2500, 'auto' #--------------------------------------------------------------- if event == 'manual': tm_out, mode = 360000, 'manual' #--------------------------------------------------------------- if event == '__TIMEOUT__': rq = db_TODAY.op( update_data_FUT=True, update_data_HST=True, rd_hst_FUT_t=True, ) if rq[0] == 0: #stroki.append('OK') stroki.append('date FUT => ' + db_TODAY.account.dt) stroki.append('last HIST => ' + db_TODAY.hist_in_file[-1].split('|')[0]) stroki.append('len HIST => ' + str(len(db_TODAY.hist_in_file))) else: stroki.append(rq[1]) stroki.append('PROFIT => ' + str(db_TODAY.account.arr[Class_ACCOUNT.prf])) #--------------------------------------------------------------- if event == 'update_cfg_SOFT' and not win_CFG_active: win_CFG_active = True win_UPD_active = False window.Hide() d = db_TODAY layout2 = [[ sg.Text('titul', size=(15, 1)), sg.Input(d.titul, key='-titul-') ], [ sg.Text('path_file_DATA', size=(15, 1)), sg.Input(d.path_file_DATA, key='-path_DATA-'), sg.FileBrowse() ], [ sg.Text('path_file_HIST', size=(15, 1)), sg.Input(d.path_file_HIST, key='-path_HIST-'), sg.FileBrowse() ], [ sg.Text('dt_start', size=(15, 1)), sg.Input(d.dt_start, key='-dt_start-') ], [ sg.Text('path_file_TXT', size=(15, 1)), sg.Input(d.path_file_TXT, key='-path_TXT-'), sg.FileBrowse() ], [sg.OK(), sg.T(' '), sg.Cancel()]] win_CFG = sg.Window('Update TABLE cfg_SOFT').Layout(layout2) win_CFG.Finalize() while True: ev_win_CFG, vals_win_CFG = win_CFG.Read() print(ev_win_CFG, vals_win_CFG) #------------------------------------------------------- if ev_win_CFG is None or ev_win_CFG == 'Cancel': win_CFG.Close() win_CFG_active = False win_UPD_active = False window.UnHide() break #------------------------------------------------------- if ev_win_CFG == 'OK': d.titul = vals_win_CFG['-titul-'] d.path_file_DATA = vals_win_CFG['-path_DATA-'] d.path_file_HIST = vals_win_CFG['-path_HIST-'] d.dt_start = vals_win_CFG['-dt_start-'] d.path_file_TXT = vals_win_CFG['-path_TXT-'] print(d.titul) print(d.path_file_DATA) print(d.path_file_HIST) print(d.dt_start) print(d.path_file_TXT) rq = d.op(wr_cfg_SOFT=True) print('rq = ', rq) #--------------------------------------------------------------- if event == 'add_HST_arch' and not win_UPD_active: win_CFG_active = False win_UPD_active = True window.Hide() d = db_TODAY layout3 = [[ sg.Text('path_file_TXT', size=(15, 1)), sg.Input(d.path_file_TXT, key='-path_TXT-'), sg.FileBrowse() ], [ sg.OK(), sg.T(' '), sg.Button('DELETE'), sg.T(' '), sg.Cancel() ]] win_ARC = sg.Window('Update ARCHIV in TABLE hist_FUT').Layout( layout3) win_ARC.Finalize() while True: ev_win_ARC, vals_win_ARC = win_ARC.Read() print(ev_win_ARC, vals_win_ARC) #------------------------------------------------------- if ev_win_ARC is None or ev_win_ARC == 'Cancel': win_ARC.Close() win_CFG_active = False win_UPD_active = False window.UnHide() break #------------------------------------------------------- if ev_win_ARC == 'OK': #--- read HIST file -------------------------------- buf_str = [] with open(vals_win_ARC['-path_TXT-'], "r") as fh: buf_str = fh.read().splitlines() #--- update table 'hist_FUT' ----------------------- buf_list = [] pAsk, pBid = range(2) for it in buf_str: dtt = datetime.strptime( it.split('|')[0], '%d.%m.%Y %H:%M:%S') ind_sec = int( dtt.replace(tzinfo=timezone.utc).timestamp()) buf_list.append([ind_sec, it]) for i in [0, 1]: print(buf_list[i], '\n') print('+++++++++++++++++++++++++\n') for i in [-2, -1]: print(buf_list[i], '\n') ''' rewrite data from table hist_FUT_today ------''' print(d.path_db_arch) conn = sqlite3.connect(d.path_db_arch) try: with conn: cur = conn.cursor() #self.cur.execute('DELETE FROM ' + 'hist_FUT_today') cur.executemany( 'INSERT INTO ' + 'hist_FUT' + ' VALUES' + '(?,?)', buf_list) conn.commit() except Exception as ex: print(ex) #------------------------------------------------------- if ev_win_ARC == 'DELETE': print(d.path_db_arch, ' - clear table hist_FUT') conn = sqlite3.connect(d.path_db_arch) try: with conn: cur = conn.cursor() cur.execute('DELETE FROM ' + 'hist_FUT') #cur.executemany('INSERT INTO ' + 'hist_FUT' + ' VALUES' + '(?,?)', buf_list) conn.commit() except Exception as ex: print(ex) #--------------------------------------------------------------- window.FindElement('txt_data').Update('\n'.join(stroki)) stts = time.strftime(frm, time.localtime()) + '\n' stts += 'event = ' + event window.FindElement('txt_status').Update(stts) return 0
def MachineLearningGUI(): sg.SetOptions(text_justification='right') flags = [ [ sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1)) ], [ sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True) ], [ sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1)) ], [ sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1)) ], [ sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True) ], [ sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1)) ], ] loss_functions = [ [ sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1)) ], [ sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1)) ], [ sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1)) ], [ sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1)) ], ] command_line_parms = [ [ sg.Text('Passes', size=(8, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), sg.Text('Steps', size=(8, 1), pad=((7, 3))), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)) ], [ sg.Text('ooa', size=(8, 1)), sg.In(default_text='6', size=(8, 1)), sg.Text('nn', size=(8, 1)), sg.In(default_text='10', size=(10, 1)) ], [ sg.Text('q', size=(8, 1)), sg.In(default_text='ff', size=(8, 1)), sg.Text('ngram', size=(8, 1)), sg.In(default_text='5', size=(10, 1)) ], [ sg.Text('l', size=(8, 1)), sg.In(default_text='0.4', size=(8, 1)), sg.Text('Layers', size=(8, 1)), sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True) ], ] layout = [[ sg.Frame('Command Line Parameteres', command_line_parms, title_color='green', font='Any 12') ], [sg.Frame('Flags', flags, font='Any 12', title_color='blue')], [ sg.Frame('Loss Functions', loss_functions, font='Any 12', title_color='red') ], [sg.Submit(), sg.Cancel()]] window = sg.Window('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout) button, values = window.Read() sg.SetOptions(text_justification='left') print(button, values)
def Everything_NoContextManager(): form = sg.FlexForm('Everything bagel', auto_size_text=True, default_element_size=(40, 1)) layout = [ [ sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25)) ], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], [ sg.Checkbox('My first checkbox!'), sg.Checkbox('My second checkbox!', default=True) ], [ sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1") ], [ sg.Multiline( default_text= 'This is the default Text should you decide not to type anything', size=(35, 3)), sg.Multiline(default_text='A second multi-line', size=(35, 3)) ], [ sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 3)), sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85) ], [ sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1') ], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))], [ sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse() ], [ sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('white', '#7E6C92')) ] ] button, values = form.LayoutAndRead(layout) del (form) sg.MsgBox('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values)
# Sample Progress Bar Meter Taken From Docs. import PySimpleGUI as sg # layout the window layout = [[sg.Text('A custom progress meter')], [ sg.ProgressBar(1000, orientation='h', size=(20, 20), key='progressbar') ], [sg.Cancel()]] # create the window` window = sg.Window('Custom Progress Meter', layout) progress_bar = window['progressbar'] # loop that would normally do something useful for i in range(1000): # check to see if the cancel button was clicked and exit loop if clicked event, values = window.read(timeout=10) if event == 'Cancel' or event is None: break # update bar with loop value +1 so that bar eventually reaches the maximum progress_bar.UpdateBar(i + 1) # done with loop... need to destroy the window as it's still open window.close()
import re import PySimpleGUI as sg import sys if len(sys.argv) == 1: event1, values1 = sg.Window('Boruvka', [[sg.Text('Choose a file')], [sg.In(), sg.FileBrowse()], [sg.Open(), sg.Cancel()]]).read(close=True) fname = values1[0] else: fname = sys.argv[1] if not fname: raise SystemExit("Cancelling: no filename supplied...") f = open(fname, "r") if f.mode == 'r': contents = f.read() contents = re.split(r'[,\s]\s*', contents) values = contents[0::3] v1 = contents[1::3] v2 = contents[2::3] def find_vertices(v1, v2): a = [] for item in v1: a.append(item)
def banner(): sg.change_look_and_feel('DarkBrown2') layout = [ [ sg.Text('!!!!OOPS!!! SYSTEM INFECTED!!!!!', text_color="red", justification="center", font=('Helvetica', 26)) ], [sg.Text('_' * 80, text_color="red")], [ sg.Text('################################################', text_color="red") ], [ sg.Text('# ', text_color="red") ], [ sg.Text('# ', text_color="red") ], [ sg.Text('# IF YOU ARE SEEING THIS BANNER,THEN ', text_color="red") ], [ sg.Text('# YOUR COMPUTER HAS BEEN COMPROMISED ', text_color="red") ], [ sg.Text('# THIS MEANS ALL YOUR IMPORTANT FILES ', text_color="red") ], [ sg.Text('# AND DOCUMENTS HAVE BEEN ENCRYPTED. ', text_color="red") ], [ sg.Text('# ', text_color="red") ], [ sg.Text('# ', text_color="red") ], [ sg.Text('################################################', text_color="red") ], [ sg.Multiline(default_text='This is the default Text should', size=(70, 8)) ], [ sg.Text('Contact Us; [email protected]', size=(50, 2), justification="center") ], [sg.Cancel(button_text="CLOSE", size=(7, 2), font='Helvetica 14')] ] window = sg.Window('DEMO RANSOMWARE', layout) event, values = window.read() window.close()
curr_bound = math.ceil(curr_bound / 2) visited[0] = True curr_path[0] = 0 TSPRec(adj, curr_bound, 0, 1, curr_path, visited) sg.theme('DarkAmber') if len(sys.argv) == 1: event1, values1 = sg.Window( 'Задача Комівояжера', [[sg.Text('Оберіть файл')], [sg.In(), sg.FileBrowse('Огляд')], [sg.Open('Відкрити'), sg.Cancel('Скасувати')]]).read(close=True) fname = values1[0] else: fname = sys.argv[1] if not fname: raise SystemExit("Збій: Ім'я файлу не введено") f = open(fname, "r") if f.mode == 'r': contents = f.read() contents = re.split(r'[,\s]\s*', contents) a = contents[0::4] b = contents[1::4]
else: msg_text = "{subtitle}\n\n{repo}\n\n{lic}\n\nver. {ver}" except: msg_text = "{subtitle}\n\n{repo}\n\n{lic}\n\nver. {ver}" cur_ver = ver #GUI info window github_text = "Go to Github" layout = [ [sg.Image(data = dpologo)], [sg.Txt('_' * 48)], [sg.Text(script_title, font=(20))], [sg.Text(msg_text.format(subtitle = subtitle, ver = ver, repo = repo, lic = lic, cur_ver = cur_ver))], [sg.Submit("OK"), sg.Cancel(github_text)]] window = sg.Window("Info", layout) event, values = window.Read() window.Close() # Open browser to Github repo if user clicked the "Go to Github" button if event == github_text: webbrowser.open_new_tab(repo) raise SystemExit("Cancelling: going to repo") if event == None: #User closed window, leave program raise SystemExit("Leaving program")
except: my_logger.log(50, "localhost sysinfo error") gc.collect() exit() #GUI try: #is_connected() layout = [ [sg.Text('Suggested IP Range to Scan: ' + nip)], [sg.Text('Enter IP Range:', size=(15, 1)), sg.InputText('localhost')], [sg.Text('Username:'******'Password:'******'*')], [sg.OK(), sg.Cancel()] ] window = sg.Window('PyBSAw', layout) while True: event, values = window.Read() if event in (None, 'Cancel'): exit() elif event in (None, 'OK'): mystr = values[0] gUsername = str(values[1]) gPW = str(values[2]) if (mystr.lower() == 'localhost'): ipRange = values[0] elif (re.match( "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\/(?:[0-9]|[1-2][0-9]|3[0-2]))?$", mystr)):
sg.Text('Request File', size=(15, 1)), sg.Input(key='req'), sg.FileBrowse() ], [ sg.Text('SVAS Log File', size=(15, 1)), sg.Input(key='svas'), sg.FileBrowse() ], [ sg.Text('HSS Log File', size=(15, 1)), sg.Input(key='hss'), sg.FileBrowse() ], [sg.Submit('Generate Logs'), sg.Cancel('Quit'), sg.Button('Reset')]] window = sg.Window('Provident Logs Validator', layout, size=(600, 300)) while True: event, values = window.read() if event in (None, 'Quit'): window.close() for proc in psutil.process_iter(): if proc.name() == 'ValidatorGUI.exe': proc.kill() elif event == 'Generate Logs': try:
import PySimpleGUI as sg layout = [[sg.OK(), sg.Cancel()]] with sg.FlexForm('OK_Cancel', auto_size_text=True) as form: ok_cancel = form.Layout(layout).Read() print(ok_cancel)
def serverGUI(): global ad, qt sf.order_menu() sg.theme("DarkBlack") layout = [[sg.Text("")], [sg.Text("")], [sg.Text("Welcome to Cafe Management System", font="Ariel 32")], [sg.Text("")], [ sg.Frame(layout=[[sg.Text("", size=(2, 2))], [ sg.Text("", size=(2, 2)), sg.Multiline(key="orders", size=(30, 30)), sg.Text("", size=(2, 2)) ], [sg.Text("", size=(2, 2))]], title="Orders"), sg.Text("", size=(1, 1)), sg.Frame(layout=[[ sg.Text("", size=(3, 2)), sg.Image(r"listen.gif", size=(1, 1), key="-listen-") ], [ sg.Text("", size=(2, 2)), sg.Multiline(key="-con-", size=(30, 29)), sg.Text("", size=(2, 2)) ], [sg.Text("", size=(2, 2))]], title="Connections"), sg.Text("", size=(1, 1)), sg.Frame(layout=[[sg.Text("")], [sg.Text("")], [ sg.Text("", size=(5, 2)), sg.Button("Add Food Item", size=(20, 2), font="Ariel 16"), sg.Text("", size=(5, 2)) ], [sg.Text("")], [ sg.Text("", size=(5, 2)), sg.Button("Add Drink", size=(20, 2), font="Ariel 16"), sg.Text("", size=(5, 2)) ], [sg.Text("")], [ sg.Text("", size=(5, 2)), sg.Button("Remove Item", size=(20, 2), font="Ariel 16"), sg.Text("", size=(5, 2)) ], [sg.Text("")], [ sg.Text("", size=(5, 2)), sg.Button("Check Feedback", size=(20, 2), font="Ariel 16"), sg.Text("", size=(5, 2)) ], [sg.Text("")], [ sg.Text("", size=(5, 2)), sg.Button("Exit", size=(20, 2), font="Ariel 16"), sg.Text("", size=(5, 2)) ], [sg.Text("")], [sg.Text("")], [sg.Text("")]], title="Options") ]] window = sg.Window('Server', layout, size=(gsys(0), gsys(1)), element_justification='c', finalize=True) while True: ord = sf.s_orders() addr = sf.add(ad) window["orders"].update(ord) window["-con-"].update(addr) window.FindElement("-listen-").UpdateAnimation("listen.gif", time_between_frames=80) event, values = window.Read(timeout=5) if event == "Remove Item": drinks, d_cost, food, f_cost = sf.order() rm = sg.Window('Remove Item', keep_on_top=True, size=(int(gsys(0) / 1.8), int(gsys(1) / 1.5)), element_justification='c') layout = [ [sg.Text("")], [sg.Text("Remove Item", font="Ariel 20")], [sg.Text("")], [ sg.Frame(layout=[ *[[ sg.Text("", size=(2, 1)), sg.Button( f"{drinks[i]}", font='Ariel 16', size=(15, 1)), sg.Text("", size=(2, 1)) ] for i in range(0, len(drinks))], *[[ sg.Text("", font='Ariel 16', size=(2, 1)), ] for i in range(0, 10 - len(drinks))] ], title="Drinks"), sg.Frame(layout=[ *[[ sg.Text("", size=(2, 1)), sg.Button( f"{food[i]}", font='Ariel 16', size=(15, 1)), sg.Text("", size=(2, 1)) ] for i in range(0, len(food))], *[[ sg.Text("", font='Ariel 16', size=(2, 1)), ] for i in range(0, 10 - len(food))] ], title="Food") ], [sg.Text("")], [sg.Cancel(font="Ariel 20", size=(15, 2))], [sg.Text("")], ] button, val = rm.Layout(layout).Read() if button != sg.WIN_CLOSED and button != "Cancel": if (sg.popup_ok_cancel( "Are you sure you want to remove this item ! ", keep_on_top=True) == "OK"): sf.rm_items(button) sg.popup_ok("Item Removed ! ", keep_on_top=True) rm.Close() if event == "Add Drink": drinks = sg.Window('New Drinks', keep_on_top=True, size=(int(gsys(0) / 2), int(gsys(1) / 2)), element_justification='c') layout = [[sg.Text("")], [sg.Text("New Drink", size=(16, 3), font="Ariel 16")], [sg.Text("")], [ sg.Text("Name", size=(10, 2), font="Ariel 16"), sg.InputText("Item Name", font="Ariel 16") ], [sg.Text("")], [ sg.Text("Cost", size=(10, 2), font="Ariel 16"), sg.InputText("50", font="Ariel 16") ], [sg.Text("")], [ sg.Submit(font="Ariel 20", size=(8, 2)), sg.Cancel(font="Ariel 20", size=(8, 2)) ]] button, val = drinks.Layout(layout).Read() if button == "Submit": sf.add_items("New drinks", val[0], val[1]) drinks.Close() if event == "Add Food Item": food = sg.Window('New Food Item', keep_on_top=True, size=(int(gsys(0) / 2), int(gsys(1) / 2)), element_justification='c') layout = [[sg.Text("")], [ sg.Text("New Food Item", size=(16, 3), font="Ariel 16") ], [sg.Text("")], [ sg.Text("Name", size=(10, 2), font="Ariel 16"), sg.InputText("Item Name", font="Ariel 16") ], [sg.Text("")], [ sg.Text("Cost", size=(10, 2), font="Ariel 16"), sg.InputText("00", font="Ariel 16") ], [sg.Text("")], [ sg.Submit(font="Ariel 20", size=(8, 2)), sg.Cancel(font="Ariel 20", size=(8, 2)) ]] button, val = food.Layout(layout).Read() if button == "Submit": sf.add_items("New Food Item", val[0], val[1]) food.Close() if event == "Check Feedback": fed = sf.read_feedback() feed = sg.Window("Feedback", size=(int(gsys(0) / 2), int(gsys(1) / 1.5)), keep_on_top=True, element_justification="c") layout = [[sg.Text("")], [sg.Text("Feedback", font="Ariel 20")], [sg.Text("")], [sg.Multiline(f"{fed}", font="Ariel 12", size=(50, 20))], [sg.Text("")], [sg.Button("Back", size=(10, 2), font="Ariel 16")]] button = feed.Layout(layout).Read() feed.Close() if (event == "Exit" or event == sg.WIN_CLOSED): if (sg.popup_ok_cancel("Are you sure you want to exit ? ", keep_on_top=True) == "OK"): break window.Close() qt = True
def _settings(): sg.theme('DarkGreen') column1 = [ [sg.Text('Select a program mode', font=("Helvetica", 10))], [ sg.InputCombo(('Play', 'CPU best of 100', 'Breeding'), size=(35, 10), default_value='Play', key="whatdo", enable_events=True) ], [sg.Checkbox('Replay?', size=(10, 1), default=False, key="replay")], [ sg.Text('File', size=(8, 1)), sg.Input(key="replayf"), sg.FileBrowse() ], [sg.Text('Select a nutrient clustering mode', font=("Helvetica", 10))], [ sg.InputCombo(('None', 'Chunk', 'Layered'), size=(35, 10), default_value='Layered', key="n0", enable_events=True) ], [ sg.Text( 'Select nutrient density... (10 ==> ~10% of blocks are nutrients)', font=("Helvetica", 10)) ], [ sg.Slider(range=(0, 100), orientation='h', size=(34, 20), default_value=1.2, resolution=0.1, key="density") ], [ sg.Text('Select nutrient clustering (higher->more clustering)', font=("Helvetica", 10), key="n1") ], [ sg.Slider(range=(0, 1), orientation='h', size=(34, 20), default_value=0.2, resolution=0.01, key="cluster") ], [ sg.Text( 'Select nutrient clustering passes (more->larger clusters)', font=("Helvetica", 10), key="n2") ], [ sg.Slider(range=(0, 10), orientation='h', size=(34, 20), default_value=3, resolution=1, key="clusterp") ], # Allow nutrient proximity? [sg.Text('Allow proximity visibility?', font=("Helvetica", 10))], [ sg.Checkbox('Proximity on', size=(10, 1), default=False, key="proxy", enable_events=True) ], # [sg.Radio('Proximity on ', "Selected proximity", default=True, size=(10,1)), sg.Radio('Proximity off', "off")], [ sg.Text( 'Select nutrient visibility... (how many blocks away do nutrient become visible?)', font=("Helvetica", 10), key="proxydistlabel", visible=False) ], [ sg.Slider(range=(0, 100), orientation='h', size=(34, 20), default_value=5, key="proxydist", visible=False) ], ] column2 = [ #2D mode [sg.Text('Select a board configuration', font=("Helvetica", 10))], [ sg.InputCombo(('3D mode', '2D mode'), size=(35, 10), default_value='3D mode', key="mode") ], [sg.Text('Select Player 1', font=("Helvetica", 10))], [ sg.InputCombo(('Human Player', 'RandomPlayer', 'GreedyPlayer', 'GreedyForker', 'ExploreExploitPlayer', 'APlayer', 'DirectionsPlayer'), size=(35, 10), default_value='GreedyPlayer', key="player1", enable_events=True) ], [sg.Input(key="gene1", visible=False)], [ sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=10, resolution=1, key="gene1l", visible=False) ], [sg.Text('Select Player 2', font=("Helvetica", 10))], [ sg.InputCombo(('Human Player', 'RandomPlayer', 'GreedyPlayer', 'GreedyForker', 'ExploreExploitPlayer', 'APlayer', 'DirectionsPlayer', 'None'), size=(35, 10), default_value='GreedyPlayer', key="player2", enable_events=True) ], [sg.Input(key="gene2", visible=False)], [ sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=10, resolution=1, key="gene2l", visible=False) ], [ sg.Text( 'Select starting energy (as a multiple of the cost to grow 1 block)', font=("Helvetica", 10)) ], [ sg.Slider(range=(0, 100), orientation='h', size=(34, 20), default_value=50, resolution=1, key="starte") ], [ sg.Text( 'Select fork cost (as a mutliple of the cost to grow 1 block)', font=("Helvetica", 10)) ], [ sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=8, resolution=1, key="fork") ], [ sg.Text( 'Select nutrient reward for claiming a nutrient block (as a mutliple of the cost to grow 1 block)', font=("Helvetica", 10)) ], [ sg.Slider(range=(0, 100), orientation='h', size=(34, 20), default_value=2, resolution=1, key="reward") ], [ sg.Text( 'Select energy goal (as a mutliple of the cost to grow 1 block)', font=("Helvetica", 10)) ], [ sg.Slider(range=(100, 1000), orientation='h', size=(34, 20), default_value=100, resolution=10, key="goal") ] ] colmain = [[sg.Image('logo.png')], [ sg.Column(column1, element_justification='center'), sg.Column(column2, element_justification='center') ], [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()], [sg.Image('ground.png')]] layout = [[sg.Column(colmain, element_justification='center')]] window = sg.Window('Settings', layout) #Event loop. Update menu as appropriate when settings are changed. Currently pretty jank while (True): event, values = window.read() if event == 'Submit': print(values) players = [] if values['player1'] == "ExploreExploitPlayer" or values[ 'player1'] == "APlayer" or values[ 'player1'] == "DirectionsPlayer": players.append({ "type": values["player1"], "genes": values["gene1"], "gene_length": int(values["gene1l"]) }) else: players.append({"type": values["player1"]}) if values['player2'] == "ExploreExploitPlayer" or values[ 'player2'] == "APlayer" or values[ 'player2'] == "DirectionsPlayer": players.append({ "type": values["player2"], "genes": values["gene2"], "gene_length": int(values["gene2l"]) }) else: players.append({"type": values["player2"]}) out = { "players": players, "mode": values["mode"], "PROX": values["proxy"], "PROX_RANGE": values["proxydist"], "DENSITY": values["density"], "STARTE": values["starte"], "FORK": values["fork"], "REWARD": values["reward"], "REPLAY": values["replay"], "REPLAYFILE": values["replayf"], "CLUSTER": values["cluster"], "CLUSTERP": values["clusterp"], "CLUSTERTYPE": values["n0"], "whatdo": values["whatdo"], "GOAL": values["goal"] } window.close() return out if event == 'Cancel': window.close() return None window['proxydist'].Update(visible=values["proxy"]) window['proxydistlabel'].Update(visible=values["proxy"]) if values['n0'] == "None": window['n1'].Update("irrelevant") window['n2'].Update("irrelevant") elif values['n0'] == "Chunk": window['n1'].Update( "Select chunk variance (higher->more variance)") window['n2'].Update("Select chunk size") elif values['n0'] == "Layered": window['n1'].Update( "Select nutrient clustering (higher->more clustering)") window['n2'].Update( "Select nutrient clustering passes (more->larger clusters)") if values['player1'] == "ExploreExploitPlayer" or values[ 'player1'] == "APlayer" or values[ 'player1'] == "DirectionsPlayer": window['gene1'].Update(visible=True) window['gene1l'].Update(visible=True) else: window['gene1'].Update(visible=False) window['gene1l'].Update(visible=False) if values['player2'] == "ExploreExploitPlayer" or values[ 'player2'] == "APlayer" or values[ 'player2'] == "DirectionsPlayer": window['gene2'].Update(visible=True) window['gene2l'].Update(visible=True) else: window['gene2'].Update(visible=False) window['gene2l'].Update(visible=False)
k='-Buff_First_Name-', enable_events=True) ], [ sg.Text('Почта', size=(7, 1)), sg.InputText(key='-Text_Email-'), sg.Button(button_text='Из буфера', k='-Buff_Email-', enable_events=True) ], [ sg.Combo(['Разработка', 'Управление качеством', 'Служба Эксплуатации'], default_value='Разработка', key='-cohort-') ], [sg.Combo(['CORP', 'REGION'], default_value='CORP', key='-domain-')], [sg.Submit('Записать'), sg.Cancel('Отмена')], [sg.Output(size=(65, 7), key='-Output-')] ] window = sg.Window('Регистрация для Лены;-)', layout) # создаем окно while True: # Ждем события event, values = window.read() if event in (None, 'Exit', 'Отмена'): break elif event == '-Buff_Last_Name-': # тут вставки из буфера win32clipboard.OpenClipboard() buff = win32clipboard.GetClipboardData() values['-Text_Last_Name-'] = buff window['-Text_Last_Name-'].update(buff.title()) win32clipboard.CloseClipboard() elif event == '-Buff_First_Name-':
import pygame, PySimpleGUI as sg, os from pygame.locals import * sg.theme('Darkblue3') layout = [[sg.Text('Song (mp3 or wav)')], [sg.In(size=(40, 0), key='FilePath'), sg.FileBrowse()], [sg.Text('Title of song')], [sg.Input(size=(50, 0), key='Title')], [sg.Text('Artist')], [sg.Input(size=(50, 0), key='Artist')], [sg.Button('Ok'), sg.Cancel()]] window = sg.Window('Lyrics Sycer Options', layout) while True: event, values = window.read() if event in (None, 'Cancel', 'Exit'): window.close() exit() if event == 'Ok': if not os.path.isfile(values['FilePath']): sg.Popup('File doesn\'t exist!', title='Error') elif not values['FilePath'].lower().endswith(('.mp3', '.wav', '.ogg')): sg.Popup( 'File type not supported!\nPlease us an mp3, wav or ogg file.') elif not values['Title']: sg.Popup('Please provide the title of the song') elif not values['Artist']: sg.Popup('Please provide the artist of the song') else: break window.close()
[ sg.Text('Loan Amount', size=(18, 1), justification='left'), sg.InputText('') ], #Loan amount + textbox [ sg.Text('Interest Rate (decimal)', size=(17, 1), justification='left'), sg.InputText('', size=(10, 1)), #Interest Rate + textbox sg.Text('Repayment duration', size=(15, 1), justification='left'), sg.InputText('', size=(10, 1)), sg.Radio('Months', "RADIO1", default=True), sg.Radio('Years', "RADIO1") ], #Duration + textbox [sg.Text('_' * 100, size=(70, 1))], #line divider [ sg.Submit(button_color=('white', 'green')), sg.Cancel(button_color=('white', 'firebrick3')) ] ] #buttons #Main Program while True: #Keep application open main_window = sg.Window( 'Financial Information Systems - Assignment 2', auto_size_text=True, default_element_size=(40, 1)).Layout( layout) # Assigning Header and variable name to the window event, values = main_window.Read( ) # Reading user input data from GUI text boxes #print(event,values) #for debugging purpose
lang_frame = [[ sg.Combo(language_choices, size=(20, 1), key="-LANG-", default_value="English (UK)") ]] window_layout = [[ sg. T("This app helps you transcribe recordings using\na cloud service from IBM Watson." ) ], [sg.Frame("API details", api_frame)], [sg.Frame("Choose a file", file_frame)], [sg.Frame("Choose a language", lang_frame)], [sg.Submit("Start"), sg.Cancel("Exit")], [sg.T("", key="-ALERT-", size=(45, 1))]] window = sg.Window("Watson Transcriber", window_layout, font=("Helvetica", 14), finalize=True) try: with open("ibm-credentials.env") as setin: for line in setin.readlines(): keyword, value = line.split("=") if keyword == "SPEECH_TO_TEXT_APIKEY": window['-APIKEY-'].update(value.strip()) elif keyword == "SPEECH_TO_TEXT_URL": window['-APIURL-'].update(value.strip())
def eBaySuperSearcherGUI(): # Drop Down list of options configs = ('0 - Gruen - Started 2 days ago in Watches', '1 - Gruen - Currently Active in Watches', '2 - Alpina - Currently Active in Jewelry', '3 - Gruen - Ends in 1 day in Watches', '4 - Gruen - Completed in Watches', '5 - Gruen - Advertising', '6 - Gruen - Currently Active in Jewelry', '7 - Gruen - Price Test', '8 - Gruen - No brand name specified') us_categories = ('Use Default with no change', 'All - 1', 'Jewelry - 281', ' Watches - 14324', ' Wristwatches - 31387', ' Pocket Watches - 3937', 'Advertising - 34', ' Watch Ads - 165254') german_categories = ('Use Default with no change', 'All - 1', 'Jewelry - 281', ' Watches - 14324', ' Wristwatches - 31387', ' Pocket Watches - 3937', 'Advertising - 1', ' Watch Ads - 19823') # the form layout with sg.FlexForm('EBay Super Searcher', auto_size_text=True) as form: with sg.FlexForm('EBay Super Searcher', auto_size_text=False) as form2: layout_tab_1 = [[ sg.Text('eBay Super Searcher!', size=(60, 1), font=('helvetica', 15)) ], [sg.Text('Choose base configuration to run')], [sg.InputCombo(configs)], [sg.Text('_' * 100, size=(80, 1))], [ sg.InputText(), sg.Text('Choose Destination Folder'), sg.FolderBrowse(target=(sg.ThisRow, 0)) ], [ sg.InputText(), sg.Text('Custom text to add to folder name') ], [sg.Text('_' * 100, size=(80, 1))], [ sg.Checkbox('US', default=True, size=(15, 1)), sg.Checkbox( 'German', size=(15, 1), default=True, ) ], [ sg.Radio('Active Listings', 'ActiveComplete', default=True, size=(15, 1)), sg.Radio('Completed Listings', 'ActiveComplete', size=(15, 1)) ], [sg.Text('_' * 100, size=(80, 1))], [ sg.Checkbox('Save Images', size=(15, 1)), sg.Checkbox('Save PDFs', size=(15, 1)), sg.Checkbox('Extract PDFs', size=(15, 1)) ], [sg.Text('_' * 100, size=(80, 1))], [sg.Text('Time Filters')], [ sg.Radio('No change', 'time', default=True), sg.Radio('ALL listings', 'time'), sg.Radio('Started 1 day ago', 'time', size=(15, 1)), sg.Radio('Started 2 days ago', 'time', size=(15, 1)), sg.Radio('Ends in 1 day', 'time', size=(15, 1)) ], [sg.Text('_' * 100, size=(80, 1))], [ sg.Text('Price Range'), sg.InputText(size=(10, 1)), sg.Text('To'), sg.InputText(size=(10, 1)) ], [sg.Text('_' * 100, size=(80, 1))], [ sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue')) ]] # First category is default (need to special case this) layout_tab_2 = [[sg.Text('Choose Category')], [ sg.Text('US Categories'), sg.Text('German Categories') ], [ sg.Radio(us_categories[0], 'CATUS', default=True), sg.Radio(german_categories[0], 'CATDE', default=True) ]] for i, cat in enumerate(us_categories): if i == 0: continue # skip first one layout_tab_2.append([ sg.Radio(cat, 'CATUS'), sg.Radio(german_categories[i], 'CATDE') ]) layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) layout_tab_2.append([sg.Text('US Search String Override')]) layout_tab_2.append([sg.InputText(size=(100, 1))]) layout_tab_2.append([sg.Text('German Search String Override')]) layout_tab_2.append([sg.InputText(size=(100, 1))]) layout_tab_2.append([sg.Text('Typical US Search String')]) layout_tab_2.append([ sg.InputText( size=(100, 1), default_text= 'gruen -sara -quarz -quartz -embassy -bob -robert -elephants -adidas -LED ' ) ]) layout_tab_2.append([sg.Text('_' * 100, size=(75, 1))]) layout_tab_2.append([ sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue')) ]) results = sg.ShowTabbedForm( 'eBay Super Searcher', (form, layout_tab_1, 'Where To Save'), (form2, layout_tab_2, 'Categories & Search String')) return results
sg.InputText('C:\\\Your Folder\\\Your File.csv') ], [ sg.Text('Comma-Separated List of Fields to Analyze (No Spaces)', size=(42, 1)), sg.InputText('Field1,Field2') ], [ sg.Text('N-Gram Size (Number of Words)', size=(42, 1)), sg.InputText('6') ], [sg.Text('Number of Sections', size=(42, 1)), sg.InputText('10')], [ sg.Text('Langugage to Use for Stop Words', size=(42, 1)), sg.Combo(values=stopWordLanguageList, default_value='english') ], [sg.Submit(), sg.Cancel()]] button, values = form.Layout(layout).Read() # Continue if the user did not cancel, did not close the dialog, and entered the right type of value if button == "Cancel" or button is None or not (values[2].isdigit()) or not ( values[3].isdigit()): sys.exit( "You either canceled/closed the dialog or entered an invalid parameter. Exiting the program." ) # Read the input inputFile = values[0] wordFilePath = os.path.dirname(inputFile) + "\\" textFields = values[1].split(',') stopWordLanguage = values[4]
def tela_alterar_opcoes(self, cliente, clientes): layout = [[sg.Text('Alterar Cliente')], [ sg.Text('Nome:', size=(8, 1), pad=(5, 5)), sg.InputText(cliente.nome, key='nome') ], [ sg.Text('CPF:', size=(8, 1), pad=(5, 5)), sg.InputText(cliente.cpf, key='cpf', enable_events=True) ], [ sg.Text('CPF inválido, insira um valor válido', pad=(5, 1), text_color='red', visible=False, key='cpf_validation_1') ], [ sg.Text('CPF já existente, insira outro CPF', pad=(5, 1), text_color='red', visible=False, key='cpf_validation_2') ], [ sg.Text('Endereço:', size=(8, 1), pad=(5, 5)), sg.InputText(cliente.endereco, key='endereco') ], [ sg.Text('Telefone:', size=(8, 1), pad=(5, 5)), sg.InputText(cliente.telefone, key='telefone', enable_events=True) ], [ sg.Text('Telefone inválido, insira um valor válido', pad=(5, 1), text_color='red', visible=False, key='telefone_validation_1') ], [ sg.Text('Telefone já existente, insira outro telefone', pad=(5, 1), text_color='red', visible=False, key='telefone_validation_2') ], [sg.Submit('Alterar'), sg.Cancel('Voltar')]] window = sg.Window('Alterar Cliente').Layout(layout) while True: form_valido = [] event, values = window.Read() if event == 'cpf' and values['cpf'] and values['cpf'][-1] not in ( '0123456789'): window['cpf'].update(values['cpf'][:-1]) if event == 'telefone' and values['telefone'] and values[ 'telefone'][-1] not in ('0123456789'): window['telefone'].update(values['telefone'][:-1]) if event in (sg.WIN_CLOSED, 'Voltar'): window.close() return 0 if event in ('Alterar'): if not self.verifica_valores.telefone(values['telefone']): window['telefone_validation_1'].update(visible=True) form_valido.append(False) else: window['telefone_validation_1'].update(visible=False) if not self.verifica_valores.verifica_telefone( int(values['telefone']), clientes, cliente.telefone): window['telefone_validation_2'].update(visible=True) form_valido.append(False) else: window['telefone_validation_2'].update(visible=False) if not self.verifica_valores.cpf(values['cpf']): window['cpf_validation_1'].update(visible=True) form_valido.append(False) else: window['cpf_validation_1'].update(visible=False) if not self.verifica_valores.verifica_cpf( int(values['cpf']), clientes, cliente.cpf): window['cpf_validation_2'].update(visible=True) form_valido.append(False) else: window['cpf_validation_2'].update(visible=False) if not form_valido: window.close() return { 'nome': str(values['nome']), 'cpf': int(values['cpf']), 'endereco': str(values['endereco']), 'telefone': int(values['telefone']) }
#!/usr/bin/env python import sys if sys.version_info[0] >= 3: import PySimpleGUI as sg else: import PySimpleGUI27 as sg layout = [[sg.Text('Filename', )], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]] event, (number, ) = sg.Window('Get filename example').LayoutAndRead(layout) import PySimpleGUI as sg event, (filename, ) = sg.Window('Get filename example').LayoutAndRead( [[sg.Text('Filename')], [sg.Input(), sg.FileBrowse()], [sg.OK(), sg.Cancel()]])
warnings.filterwarnings('ignore') plt.style.use('bmh') import PySimpleGUI as sg #declaring variables layout = [[ sg.Text('Supplemental Assigment', size=(30, 1), font=("Helvetica", 25), text_color='blue') ], [sg.Text('Paste your data set full url here')], [sg.InputText()], [ sg.Submit('Upload', button_color=('white', 'green')), sg.Cancel('Reset') ]] data_source = 'http://mf2.dit.ie:8080/geoserver/topp/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=topp:states&maxFeatures=50&outputFormat=json' ##Reading the dataset from server states = geopandas.read_file(data_source) states.plot(figsize=(10, 10), alpha=.7, edgecolor='k') # plt.show() plt.savefig('Figure 1 US Population.png') ##Print the head of states with unique names # print(states.head()) # print(states['STATE_NAME']) # Plot Union of polygons
def MachineLearningGUI(): sg.SetOptions(text_justification='right') form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form layout = [[ sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16)) ], [ sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)) ], [ sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1)) ], [ sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1)) ], [ sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True) ], [sg.Text('_' * 100, size=(65, 1))], [sg.Text('Flags', font=('Helvetica', 15), justification='left')], [ sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1)) ], [ sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True) ], [ sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1)) ], [sg.Text('_' * 100, size=(65, 1))], [ sg.Text('Loss Functions', font=('Helvetica', 15), justification='left') ], [ sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1)) ], [ sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1)) ], [ sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1)) ], [ sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1)) ], [sg.Submit(), sg.Cancel()]] button, values = form.LayoutAndRead(layout) del (form) sg.SetOptions(text_justification='left') return button, values
tktPath = r'C:\temp\etf\pricestocheck' listasPath = r'C:\Users\cevdea\Google Drive\trading\kirk\2019\Listas' listasFile = '2018_ListasTrack.xlsx' tktFile = '20200419.txt' sector = 'Sector' industry = 'Industry' price = 'Price' tktListEval = [] res = {} sg.theme('Dark Blue 3') # please make your windows colorful layout = [[sg.Text('Filename')], [sg.Input(key='-IN-'), sg.FileBrowse(initial_folder=tktPath)], [sg.OK(), sg.Cancel()]] window = sg.Window('Get filename example', layout) while True: # Event Loop event, values = window.read() print(event, values) if event in (None, 'Cancel'): break if event == 'OK': print(values) tktFile = values['-IN-'] f = open(tktFile, "r") text = f.readlines() for linea in text: linea = linea.rstrip(newLineChar)
layout = [ [sg.Text('Input the Number: ', key="UpperText")], [sg.Input(), sg.FileBrowse(key="Browse")], [ sg.Text( 'Destination Directory (If one is not specified it will be downloaded to <current directory>/Downloads/)' ) ], [sg.Input(), sg.FolderBrowse()], [ sg.Text(" ", key="DownloadText") ], [sg.ProgressBar(100, orientation='h', size=(45, 15), key="progressbar")], [ sg.OK(button_text="Go!"), sg.Cancel(), sg.Radio("Number", "rad1", background_color='grey', default=True), sg.Radio("File", "rad1", background_color='grey') ] ] #initialization of the window object window = sg.Window('nHentai.net GUI Downloader', layout) #progress bar for a single download progressbar = lambda current, total: window["progressbar"].UpdateBar( iteration(current, total)) #progressbar for downloading from a file messageUpdateFILES = lambda number: window["DownloadText"].update( "Now Downloading {}".format(number))
[ sg.Text( 'Please copy the language list you want to translate into and paste here:' ) ], [sg.InputText(f'{destination_lang_infile}')], [sg.Text('Please enter the language to translate from:')], [sg.InputText(f'{original_lang_infile}')], [sg.Text('Please choose your translation excel file:')], [sg.Input(f'{excel_file_path_infile}'), sg.FileBrowse()], [sg.Text('Please enter the NAME(not nickname) of your survey:')], [sg.InputText(f'{surveyname}')], [sg.Output(size=(61, 5))], # [sg.ProgressBar(len(destination_lang_infile), orientation='h', size=(57, 20), key='progressbar')], [sg.Submit(), sg.Cancel('Exit')] ] window = sg.Window('Translation Substitution', layout, font=('Helvetica', 15)) # progressbar = window['progressbar'] while True: event, values = window.read() if event in (None, 'Exit'): break if event == 'Submit': destination_lang = values[0].strip().split() original_lang = values[1].strip() excel_file_path = values[2]
# ------ Main Layout ------ # layout = [ [sg.Menu(menu_def, tearoff=True)], [sg.Text('Sparrow', size=(55, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Video Storage Location', size=(17, 1), auto_size_text=False, justification='left'), sg.InputText('Default Folder'), sg.FolderBrowse()], [sg.Image(filename='', key='_IMAGE_', size=(10, 10)), sg.Frame('Display Video Feed', [[ sg.Button('Hide/Show', button_color=('white', 'Black')) ]]), sg.Frame('Camera Controls', [[ sg.Button('Record', button_color=('white', 'red')), sg.Button('Pause', button_color=('black', 'yellow')), sg.Button('Resume', button_color=('white', 'green')), sg.Button('Stop', button_color=('white', 'black')) ], [sg.Text('Put the next row here')]]) ], [sg.Submit(tooltip='Click to submit this window'), sg.Cancel()] ] # Keep no_titlebar == True to disable title bar # Dimensions hardcoded to screen values # Add element_justification='c' to center the elements window = sg.Window('Sparrow v1', layout, no_titlebar=False, default_element_size=(40, 1), grab_anywhere=False, location=(0, 0), size=(1024, 600), keep_on_top=False).Finalize() # Maximize the window automatically window.Maximize() # Terminal command tests # list_files = subprocess.run(["ls", "-l"]) # print("The exit code was: %d" % list_files.returncode)
import PySimpleGUI as sg sg.ChangeLookAndFeel('Reddit') print("Font: {}".format(sg.POPOUT_WINDOW_FONT)) sg.POPOUT_WINDOW_FONT = 'LucidaSans' sg.SetOptions(element_padding=(0,0)) print("Font: {}".format(sg.POPOUT_WINDOW_FONT)) layout = [ [sg.Text('Tech File', font='LucidaSans', size=(20,1)), sg.In(key='tech_file'), sg.FileBrowse()], [sg.Text('IPF List', font='LucidaSans', size=(20,1)), sg.In(key='ipf_list'), sg.FileBrowse()], [sg.Text("\n")], # [sg.InputText()], # [sg.InputOptionMenu([0, 1, 2,3])], [sg.Radio('From file', "RV_USE_CONDITIONS", default=True), sg.Radio('Create table', "RV_USE_CONDITIONS", enable_events=True)], [sg.Text('Conditions File', font='LucidaSans', size=(20,1)), sg.In(), sg.FileBrowse()], [sg.Submit(), sg.Cancel()]] window = sg.Window('StatEM', layout, font='LucidaSans') event, values = window.read() print("values: {}".format(values)) window.close() # text_input = values[0] # sg.popup('You entered', text_input) headings = ['HEADER 1', 'HEADER 2', 'HEADER 3','HEADER 4'] # the text of the headings header = [[sg.Text(' ')] + [sg.Text(h, size=(14,1)) for h in headings]] # build header layout input_rows = [[sg.Input(size=(15,1), pad=(0,0)) for col in range(4)] for row in range(20)] sub_canc = [sg.Submit(), sg.Cancel()] layout = header + input_rows layout.append([sg.Text("\n")])