def test_width(): a = App() t = TextBox(a) default_width = t.width t.width = 30 assert t.width == 30 t.width = "fill" assert t.width == "fill" a.destroy()
def CustomLiveCollection(): customInformationWindow = Window(app, title="Custom Information Entry", layout="grid") customInformationWindow.width = 450 customInformationWindow.height = 180 customInformationWindow.bg = "Grey" usageText = Text(customInformationWindow, text="Enter the number of cycles you wish to run for...", grid=[0, 0], align="top") usageText.text_size = 15 informationText = Text(customInformationWindow, text="1 Cycle = 10 seconds", grid=[0, 1], align="top") valueTextBox = TextBox(customInformationWindow, grid=[0, 2], align="top") valueTextBox.width = 6 valueTextBox.bg = "White" beginButton = PushButton( customInformationWindow, text="Begin...", grid=[0, 3], align="top", command=lambda: LiveCollection(valueTextBox.value)) beginButton.width = 15 beginButton.height = 5 beginButton.bg = "White"
password_chk_text.value = "correct" sleep(.2) mainmenu_window.show(wait=True) admin_mainmenu_pass_window.hide() password_box.value = "" else: password_chk_text.value = "incorrect" password_box.value = "" elif not password_box.value == admin_password: password_chk_text.value = "incomplete and incorrect" password_box = TextBox(admin_mainmenu_pass_window, grid=[0, 0]) password_box.height = 30 password_box.width = 20 password_box.update_command(chk_password) password_chk_text = Text(admin_mainmenu_pass_window, text="", grid=[1, 0]) #admin menu password window ends #change admin password password window starts def chk_chg_password(): passw = readPwd() if len(pass_box.value) == 8: if pass_box.value == passw: #admin_password: pass_chk_text.value = "correct" sleep(.2) change_password_window.show(wait=True) change_pass_password_window.hide()
from guizero import App, TextBox, Text, Slider, PushButton, Picture, Combo, CheckBox, ButtonGroup, Box app = App(title="different sizes", width=700, height=700) text = Text(app, "lets change some sizes") text.width = 30 text.height = 2 text_box = TextBox(app, "some text") text_box.width = 50 slider = Slider(app) slider.width = 300 slider.height = 30 button = PushButton(app) button.width = 20 button.height = 2 pic = Picture(app, image="guizero.gif") pic.width = 400 pic.height = 50 combo = Combo(app, ["martin", "laura", "rik"]) combo.width = 50 combo.height = 2 check = CheckBox(app, "tick me") check.width = 17 check.height = 2
avvisi.value="Errore di connessione, l'altro client potrebbe non essere connesso" else: avvisi.value="Non inviare messaggi vuoti" if __name__ == "__main__": try: porta_server=int(sys.argv[1]) indirizzo_ip_client=str(sys.argv[2]) porta_client=int(sys.argv[3]) except: print("Inserisci in ordine: porta del server, indirizzo ip del client, porta del client ") sys.exit(1) interfaccia= App(layout="grid") messaggi_ricevuti = Text(interfaccia, text="Messaggi ricevuti",align="left",grid=[0,0]) lista_messaggi=ListBox(interfaccia,scrollbar=True,align="left",command=apri_messaggio,grid=[0,2,6,1]) lista_messaggi.width=80 lista_messaggi.repeat(500,stampa_messagggi) text = Text(interfaccia, text="Inserisci il testo del messaggio",align="left",grid=[0,6]) textbox = TextBox(interfaccia,grid=[0,7,4,1]) textbox.width=30 tastoInvio = PushButton(interfaccia, text="Invia",align="left", command=invia_dati,grid=[5,7]) Labelavvisi=Text(interfaccia, text="Avvisi:",align="left",grid=[0,8]) avvisi=Text(interfaccia,size=9,align="left",grid=[0,9]) thread_server=serverThread(("localhost",porta_server)) thread_server.start() interfaccia.display() thread_server.restaAttivo = False thread_server.join()
divider_x = Text(box, text="", grid=[1, 0]) divider_x.width = 10 divider_x.font = 'Source code pro' temp_label = Text(box, text="Temperature", grid=[1, 1], font='Source code pro') ph_label = Text(box, text="PH", grid=[2, 1]) oxygen_label = Text(box, text="Oxygen", grid=[3, 1], font='Source code pro') temp_label.width = 15 ph_label.width = 15 oxygen_label.width = 15 temp_th = TextBox(box, text="0", grid=[1, 2]) ph_th = TextBox(box, text="0", grid=[2, 2]) dox_th = TextBox(box, text="0", grid=[3, 2]) temp_th.width = 10 temp_th.font = 'Source code pro' ph_th.width = 10 ph_th.font = 'Source code pro' dox_th.width = 10 dox_th.font = 'Source code pro' divider = Text(box, text="", grid=[1, 3]) divider.width = 10 divider.font = 'Source code pro' temp_led = PushButton(box, text='', grid=[1, 4]) ph_led = PushButton(box, text='', grid=[2, 4]) dox_led = PushButton(box, text='', grid=[3, 4]) temp_led.width = 2 ph_led.width = 2
sleep(.2) mainmenu_window.show(wait=True) admin_mainmenu_pass_window.hide() password_box.value = "" else: password_chk_text.value = "incorrect" password_box.value = "" elif not password_box.value == admin_password: password_chk_text.value = "incomplete and incorrect" password_box = TextBox(admin_mainmenu_pass_window, grid=[0,0]) password_box.height=30 password_box.width=20 password_box.update_command(chk_password) password_chk_text = Text (admin_mainmenu_pass_window, text="", grid=[1,0]) #admin menu password window ends #change admin password password window starts def chk_chg_password(): passw = readPwd() if len(pass_box.value) == 8: if pass_box.value == passw:#admin_password: pass_chk_text.value = "correct" sleep(.2) change_password_window.show(wait=True) change_pass_password_window.hide() else: pass_chk_text.value = "incorrect"
use_fixture.bg = "#999999" use_fixture.text_size=20 # Buttons tst_btn = PushButton(button_box, command=begin_test, text = "6. Begin Test", grid=[0,6]) tst_btn.text_size = 30 tst_btn.enabled = False save_btn = PushButton(button_box, command=save_test, text = "7. Save Test", grid=[1,6]) save_btn.text_size = 30 save_btn.enabled = False graph_box = Box(app, layout="grid", grid=[6,0,6,6], border=3) noise_btn = PushButton(graph_box, command=plot_noise, image="Noise_400x300.png", grid=[0,0]) counts_btn = PushButton(graph_box, command=plot_counts, image="Counts_400x300.png", grid=[1,0]) results_box = Box(app, layout='grid', grid=[0,6, 7,6], border=3) results_lbl = Text(results_box, grid=[0,0], text="Test Results: Passed") results_lbl.text_size = 30 results_lbl.bg='green' # make a multiline test from list fill = "" for l in item_numbers: fill += str(l) +"\n" result_txtbox=TextBox(results_box, grid=[0,1], text=fill, align="left", multiline=True, scrollbar=True) result_txtbox.height = 15 result_txtbox.width = 175 app.display()