def openWindowImageSearch(): print('Image search') ROOT_DIR = os.path.dirname( os.path.abspath(__file__))[0:-7] + "\\data\\blohsaved.png" print(ROOT_DIR) image_elem = sg.Image(ROOT_DIR) layoutOperation = [[ sg.Text('An image says what a thousand words can\'t..') ], [sg.Text('The image :'), sg.InputText('path'), sg.FileBrowse()], [image_elem], [sg.Button('Search for me'), sg.Button('Cancel')]] windowOperation = sg.Window('Text it out').Layout(layoutOperation) while True: eventOperation, valuesOperation = windowOperation.Read(timeout=50) if eventOperation in (None, 'Cancel'): windowOperation.close() main() break elif eventOperation in ('Search for me'): windowOperation.close() searchByImageAlgorithm(valuesOperation[0]) if valuesOperation[0] != "path": image_elem.update(valuesOperation[0])
def searchRouteByLocationWindow(location): layoutOperation = [[sg.Text('What place do you want to explore ?')], [sg.InputText(location)], [], [sg.Text('By what do you want to travel ?')], [ sg.Checkbox('Personal car'), sg.Checkbox('On foot', default=True), sg.Checkbox("Public transportation") ], [sg.Text('What are your interests ?')], [ sg.Checkbox('Arts'), sg.Checkbox('Arhitectural'), sg.Checkbox("Entertainment") ], [sg.Button('Search for me'), sg.Button('Cancel')]] windowOperation = sg.Window('Text it out').Layout(layoutOperation) while True: eventOperation, valuesOperation = windowOperation.Read() if eventOperation in (None, 'Cancel'): windowOperation.close() main() break elif eventOperation in ('Search for me'): windowOperation.close() print(valuesOperation) searchRouteByLocationAlgorithm(valuesOperation[0], valuesOperation)
def main(): layout = [[sg.Text('This is a text element')], [ sg.Input() ], [ sg.Combo(['Combo 1']) ], [sg.Text('If you close the browser tab, the app will exit gracefully')], [sg.InputText('Source')], [sg.InputText('Dest')], [sg.Ok(), sg.Cancel()]] window = sg.Window('Demo window..', layout) i = 0 while True: event, values = window.read(timeout=1) if event != sg.TIMEOUT_KEY: print(event, values) if event is None: break i += 1 window.close()
def openWindowRoutesSearch(): print('Route search') layoutOperation = [[sg.Text('What place do you want to explore ?')], [sg.InputText('location')], [sg.Button('HERE !'), sg.Button('Cancel')]] windowOperation = sg.Window('Where ?').Layout(layoutOperation) while True: eventOperation, valuesOperation = windowOperation.Read() if eventOperation in (None, 'Cancel'): windowOperation.close() main() break else: windowOperation.close() searchRouteByLocationWindow(valuesOperation[0])
def openWindowTextSearch(): print('Text search') layoutOperation = [[sg.Text('A few words to guide us..')], [sg.InputText('Couple of words')], [sg.Button('Search for me'), sg.Button('Cancel')]] windowOperation = sg.Window('Text it out').Layout(layoutOperation) while True: eventOperation, valuesOperation = windowOperation.Read() if eventOperation in (None, 'Cancel'): windowOperation.close() main() break else: windowOperation.close() searchByTextAlgorithm(valuesOperation[0])
def __init__(self): # initialize controller parameters (in dict) self.params = self.initialize_params() # FIWARE parameters self.cb_url = os.getenv("CB_URL", "http://localhost:1026") self.entity_id = None # will be read on the web GUI self.entity_type = "PID_Controller" self.service = os.getenv("FIWARE_SERVICE", '') self.service_path = os.getenv("FIWARE_SERVICE_PATH", '') # Create the fiware header fiware_header = FiwareHeader(service=self.service, service_path=self.service_path) # Create orion context broker client self.ORION_CB = ContextBrokerClient(url=self.cb_url, fiware_header=fiware_header) # initial pid controller list self.controller_list = [] try: self.refresh_list() except: pass # initialize gui window sg.theme("DarkBlue") pid_id_bar = [[ sg.Text("Controller ID", size=(10, 1)), sg.Combo(self.controller_list, key="controller_list"), sg.Button("Refresh") ]] param_bars = [[ sg.Text(param.capitalize(), size=(10, 1)), sg.InputText(self.params[param], key=param) ] for param in self.params.keys()] io_bars = [[sg.Button("Send"), sg.Button("Read")]] layout = pid_id_bar + param_bars + io_bars self.window = sg.Window("PID controller", layout, web_port=80, web_start_browser=True)
def __add_task(self): layout1 = [[sg.Text("Write the task title:")], [sg.InputText()], [sg.Button("Next")]] window1 = sg.Window("To-Do app", layout1, resizable=True) while True: event, values = window1.read() if event == sg.WIN_CLOSED: return if event == "Next": break new_task = Task() new_task.title_ = values[0] window1.close() date_list = sg.popup_get_date() new_task.date_ = date(date_list[2], date_list[0], date_list[1]) str1 = "Is it a frog?" # + emoji.emojize(':frog:') layout2 = [[sg.Text(str1)], [ sg.Text("About 'Eat the frog' method.", text_color='#0645AD', enable_events=True, key='-LINK-') ], [sg.Button("Yes")], [sg.Button("No")]] window2 = sg.Window("To-Do app", layout2, resizable=True) while True: event, values = window2.read() if event == sg.WIN_CLOSED: return if event == '-LINK-': webbrowser.open( r'https://todoist.com/productivity-methods/eat-the-frog') if event == "Yes": new_task.is_frog_ = True break if event == "No": new_task.is_frog_ = False break window2.close() if not (new_task.date_ in self.undone_tasks_): self.undone_tasks_[new_task.date_] = [] self.undone_tasks_[new_task.date_].append(new_task)
sg.Frame( "To do", [ [ sg.Listbox( values=todo_list, key="todo_list", size=(WIDTH, HEIGHT), #no_scrollbar=True, #font=("Times New Roman", 12), enable_events=True, #right_click_menu=['&Right', ["Done", "Copy", "Delete"]], background_color='white', ) ], [sg.InputText(key="input_text_todo", size=(25, 1))], ], #font = 15, background_color='orange', element_justification='right', title_color='dark blue', title_location=sg.TITLE_LOCATION_TOP_RIGHT, ) ], [ sg.OK('+', key="add_item"), sg.Button('-', key="Delete-todo"), sg.Button('->', key="Done") ], #add_ext_ is the key for event handling [ sg.Frame(
import PySimpleGUIWeb as sg layout = [ [sg.InputText()], [ sg.Button('CE', size=(50, 50)), sg.Button('Backspace', size=(80, 50)), sg.Button('Enter', size=(80, 50)) ], [ sg.Button('7', size=(50, 50)), sg.Button('8', size=(50, 50)), sg.Button('9', size=(50, 50)), sg.Button('/', size=(50, 50)) ], [ sg.Button('4', size=(50, 50)), sg.Button('5', size=(50, 50)), sg.Button('6', size=(50, 50)), sg.Button('*', size=(50, 50)) ], [ sg.Button('1', size=(50, 50)), sg.Button('2', size=(50, 50)), sg.Button('3', size=(50, 50)), sg.Button('-', size=(50, 50)) ], [ sg.Button('+/-', size=(50, 50)), sg.Button('0', size=(50, 50)), sg.Button('.', size=(50, 50)),
size=(10, 1)) ], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')] ] layout = [ [sg.Menu(menu_def, tearoff=True)], [ sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE) ], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], [ sg.Frame(layout=[[ sg.Checkbox('Checkbox', size=(10, 1)), sg.Checkbox('My second checkbox!', default=True) ], [ sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10, 1)), sg.Radio('My second Radio!', "RADIO1") ]], title='Options', title_color='red', relief=sg.RELIEF_SUNKEN,
launch.layout_new = [[]] launch.layout = launch.layout_new launch.layout_final_new = [[]] launch.layout_final = launch.layout_final_new print("Changing View...") test = launch.mod.get("{}".format(element[0])) print(launch.mod.get("Add-Computer")[1]) input_list = [] for x in test[2]: input_list.append(x) launch.layout.append( [Sg.InputText("{}".format(str(x)), key="{}".format(x))]) launch.layout_finals = [ [ Sg.Column([[ Sg.DropDown(launch.dropdown_list, enable_events=True, default_value=v[0]) ], [Sg.Button("Execute", size=(25, 1))]]) ], [Sg.Column(launch.layout_final)], [ Sg.DropDown(launch.mod.get("{}".format(element[0]))[3], key="dd_ex") ], [ Sg.Column(launch.layout),
# msg = "Welcome to Xpnsit, the best way to manage your expenses! To begin, login or signup below" # title = 'Xpnsit v0.1' # login_fields = ['Username','Password'] # gui.Popup(msg,title = title) login_window = sg.Window('Xpnsit v0.1') space1 = ' ' ## Tabs so that I could justify the fields and buttons space2 = ' ' layout = [ [sg.Text('Welcome to Xpnsit, the best way to manage your expenses! To begin, login or signup below.',font = ('Helvetica',15),justification='center')], [sg.T(space1),sg.Text('Username', size=(15, 1)), sg.InputText(key='_name_')], [sg.T(space1),sg.Text('Password', size=(15, 1)), sg.InputText(key='_password_',password_char = '*')], [sg.T('')], [sg.T(space2),sg.Button('Login', tooltip='Login',bind_return_key=True), sg.Button('Signup',tooltip='Signup (if you haven\'t already)')] ] login_window.Layout(layout) # dashboard.Layout(dashboard_layout) # global login_window,dashboard dash_active = False while True: event, values = login_window.Read() if event is None or event == 'Exit':
sg.Combo( values=list(EXPORTOPTIONS.keys()), default_value=exportoption, key='_EXPORTOPTION_', enable_events=True, readonly=False, tooltip='Choose data export format option', disabled=False, size=(30, 1)), sg.Text('Data export option', size=(60, 1), font=('Helvetica', 16)) ], [ sg.InputText( default_text='', key='_DEVIDINPUT_', enable_events=False, tooltip='Input Device ID/Name for JSON export', disabled=False, size=(30,1), do_not_clear=True, ), sg.Text('Device ID/Name', size=(30,1), font=('Helvetica, 16')) ], [ sg.InputText( default_text='', key='_JSONURLINPUT_', enable_events=False, tooltip='Input JSON Data Export URL(http://)', disabled=False, size=(60,1), do_not_clear=True, ),
[sg.Button('Queue', font=('Futura', 18), key='QUEUE'), sg.Button('Clear', font=('Futura', 18), key='CLEAR')], [sg.Listbox('', [], key='TABLE', size=(360, 200), )], ]) col5 = sg.Column([ [sg.Button('Render', font=('Futura', 18), pad=(5, 5), size=(360, 100), key='RENDER')], [sg.Button('List Folders in Destination', font=('Futura', 18), key='REFRESHOUTPUT')], [sg.Listbox('', [], size=(360, 200), key='OUTPUTSUB', enable_events=True)], [sg.Button('ABORT', font=('Futura', 18), button_color='yellow', key='ABORT', pad=(305, 5))] ]) col4 = sg.Column([ [ sg.Checkbox('Copy xml', key='COPYXML', default=True, font=('Futura', 15))] ]) layout = [[sg.InputText('', size=(36, 1), key='WATCHPATH')], [col1], [col2], [col3], [col4], [sg.InputText('', size=(36, 1), key='OUTPUTPATH')], [col5]] # must include disable_close=True to let the server run in background window = sg.Window('Resolve Transkode v0.1a', layout, web_port=29259, finalize=True, disable_close=True) window['WATCHPATH'].update('/Users/') while True: # read PySimpleGUI window event, values = window.read() if event == 'SOURCEPATHS': print('listbox event!')
return c.lastrowid def intersection(lst1, lst2): lst3 = [value for value in lst1 if value in lst2] return lst3 database = r'F:/Desktop/IV semestr/Inżynieria oprogramowania/Reservoir/database/reservoir.db' db = create_connection(database) ##################################################################################### logowanie = [[sg.Text('Witaj w Reservoir!')], [sg.Text('Wprowadź swój login oraz hasło')], [sg.Text('Login: '******'login')], [sg.Text('Hasło: '), sg.InputText(key='haslo')], [sg.Button('Zaloguj się'), sg.Button('Załóż konto')]] window = sg.Window('Reservoir').Layout(logowanie) while True: event, values = window.read() if event == 'Zaloguj się': com = 'SELECT Login, Haslo, RolaId_roli FROM Uzytkownik WHERE (Login="******" AND Haslo="{}");'.format( values['login'], values['haslo']) login = values['login'] konto = executeSQLcommand(db, com) if len(konto) == 0: