def secondfunc(): global pin8_flag, pin9_flag, pin10_flag, pin11_flag, d0_value, d1_value, d2_value, d3_value, a0_value, a1_value, a2_value, a3_value global a0_textbox, a1_textbox, a2_textbox, a3_textbox, run_update, circle_2, circle_3, circle_4, circle_5 pin8_flag = "0" pin9_flag = "0" pin10_flag = "0" pin11_flag = "0" a0_value = "0" a1_value = "0" a2_value = "0" a3_value = "0" d0_value = "0" d1_value = "0" d2_value = "0" d3_value = "0" app.bg = "#00cc99" app.width = 400 app.height = 300 wanted_text = Text(app, "IO data acquisition system GUI") wanted_text.text_size = 12 wanted_text.font = "Times New Roman" wanted_text.text_color = "#000000" Box_input_digital = Box(app, layout="grid", border=1) digital_text = Text(Box_input_digital, "Input digital", grid=[0, 0]) circle_2 = Drawing(Box_input_digital, height=11, width=11, grid=[0, 1]) circle_3 = Drawing(Box_input_digital, height=11, width=11, grid=[1, 1]) circle_4 = Drawing(Box_input_digital, height=11, width=11, grid=[2, 1]) circle_5 = Drawing(Box_input_digital, height=11, width=11, grid=[3, 1]) box_output = Box(app, layout="grid", border=1) pin8_button = PushButton(box_output, text="pin8", command=pin8_out, grid=[0, 0]) pin9_button = PushButton(box_output, text="pin9", command=pin9_out, grid=[1, 0]) pin10_button = PushButton(box_output, text="pin10", command=pin10_out, grid=[0, 1]) pin11_button = PushButton(box_output, text="pin11", command=pin11_out, grid=[1, 1]) circle_2.oval(0, 0, 10, 10, color="black", outline=True, outline_color="black") circle_3.oval(0, 0, 10, 10, color="black", outline=True, outline_color="black") circle_4.oval(0, 0, 10, 10, color="black", outline=True, outline_color="black") circle_5.oval(0, 0, 10, 10, color="black", outline=True, outline_color="black") circle_2_text = Text(Box_input_digital, "2", grid=[0, 2]) circle_2_text = Text(Box_input_digital, "3", grid=[1, 2]) circle_2_text = Text(Box_input_digital, "4", grid=[2, 2]) circle_2_text = Text(Box_input_digital, "5", grid=[3, 2]) box_input_analog = Box(app, layout="grid", border=1) a0_text = Text(box_input_analog, "A0", grid=[0, 0]) a1_text = Text(box_input_analog, "A1", grid=[0, 1]) a2_text = Text(box_input_analog, "A2", grid=[0, 2]) a3_text = Text(box_input_analog, "A3", grid=[0, 3]) a0_textbox = TextBox(box_input_analog, text=a0_value, grid=[1, 0]) a1_textbox = TextBox(box_input_analog, text=a1_value, grid=[1, 1]) a2_textbox = TextBox(box_input_analog, text=a2_value, grid=[1, 2]) a3_textbox = TextBox(box_input_analog, text=a3_value, grid=[1, 3]) button_exit = PushButton(app, text="Exit", command=exit_program) return app
def main(): """called only when run directly, allowing module testing""" #pathname=r"C:\Users\T\Pictures\Camera Roll" if __name__ == "__main__": from guizero import App, PushButton, Text, ListBox, Picture, TextBox app = App(layout="grid") PushButton(app, command=getFolder, text="Get folder", grid=[0, 0]) file_name = Text(app, grid=[1, 0, 3, 1]) datelist_box = ListBox(app, grid=[0, 1], items=[], command=updatePhotoList) photolist_box = ListBox(app, grid=[1, 1], items=[], command=showPicture, multiselect=True) picture = Picture(app, grid=[3, 1, 2, 3], width=200, height=200) file_date = Text(app, grid=[0, 2, 1, 3]) newName = TextBox(app, grid=[2, 4]) PushButton(app, command=addFolderText, text="Rename", grid=[4, 4]) PushButton(app, command=addFolderText, args=[True], text="Reset", grid=[4, 5]) PushButton(app, command=generateFolders, text="Generate", grid=[0, 5]) app.display() #End
# settings window settings_window = Window(app, title="Settings", width=settings['window_width'], height=settings['window_height']) settings_window.hide() # create ui settings_box = Box(settings_window, layout="grid") i = 0 for key, value in settings.items(): txt = Text(settings_box, text=f"{key}", grid=[0, i], align="left", size=16) txtBox = TextBox(settings_box, text=f"{value}", grid=[1, i], align="left", width=30) txtBox.text_size = 16 i = i + 1 save_btn = PushButton(settings_window, text="Save", align="left", width="fill", height="fill", pady=20) save_btn.when_clicked = save_btn_handler save_btn.text_size = 20 cancel_btn = PushButton(settings_window, text="Cancel",
from guizero import App, Text, TextBox,PushButton, Slider, Picture #used for pushbutton def say_my_name(): welcome_message.value = my_name.value #used for slider def change_text_size(slider_value): welcome_message.size = slider_value #Title in Top Bar app = App(title="Mirror Mirror") #Text inside of frame welcome_message = Text(app,text="Welcome to my App", size=40, font="Times New Roman", color="lightblue") #TextBox my_name = TextBox(app) #PushButton Widget- updates takes the value from the Text Box update_text = PushButton(app, command=say_my_name, text="Display my name") #Slider Widget text_size = Slider(app, command=change_text_size, start=10, end=80) #Picture my_pic = Picture(app, image="GIFS.gif") #Displays the Window app.display()
def slider_change1(slider_value): #slider value for motor 1 textbox.value = slider_value print(slider_value) servo1 = AngularServo(Servo1, min_pulse_width=minPulseWidth, max_pulse_width=maxPulseWidth, initial_angle=0, min_angle=-0, max_angle=90) servo1.angle = int(slider_value) def slider_change2(slider_value): #slider value for motor 2 textbox.value = slider_value print(slider_value) servo2 = AngularServo(Servo2, min_pulse_width=minPulseWidth, max_pulse_width=maxPulseWidth, initial_angle=0, min_angle=-0, max_angle=90) servo2.angle = int(slider_value) app = App() slider1 = Slider(app, start=0, end=90, width="fill", command=slider_change) slider2 = Slider(app, start=0, end=90, width="fill", command=slider_change2) textbox = TextBox(app) print(textbox.value) app.display()
l_txt.set(w) else: pass except ValueError: e_txt.set("Error Received") # Create a window outline window1 = App("Comparator", width=400, height=400, layout="grid") # Create Text Fields # spacer Text(window1, "", grid=[1, 0]) # get integer 1 Text(window1, "Enter an Integer", grid=[2, 1]) One_tb = TextBox(window1, grid=[2, 2]) # spacer Text(window1, grid=[3, 0]) # get integer 2 Text(window1, "Enter another Integer", grid=[4, 1]) Two_tb = TextBox(window1, "", grid=[4, 2]) # spacer Text(window1, "", grid=[5, 0]) # command compare pushbutton Text(window1, "", grid=[6, 1]) PushButton(window1, text="COMPARE", grid=[6, 2], command=calc) # spacer Text(window1, "", grid=[7, 1]) # text fields for larger number Text(window1, "Larger Number", grid=[8, 1]) l_txt = Text(window1, "", grid=[8, 2])
def test_clear(): a = App() t = TextBox(a, text="foo") t.clear() assert t.value == "" a.destroy()
ydl_opts = { 'outtmpl': '{}\%(title)s.%(ext)s'.format(save) } with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download(['{}'.format(input_box.value)]) picture.visible = True button_start.destroy() button_start = PushButton(app, text="Download Complete!") button_start.after(3000, reset) app = App(width = 500, height = 250) url_text = Text(app, text="Paste Video URL below") input_box = TextBox(app, width = 600) picture = Picture(app, visible=False, width = 100, height = 100, image="done.gif") button_dest = PushButton(app, width = 50, text = "Chose Save Location", command=save_dir) app.display() #CODE FOR COMMAND PROMPT USE SOLUTION. GAVE PERMISSION ISSUES WHEN CHOOSING DIRECTORY ##--------------------------------------------------------------------------------------------- ''' url = input() out = sp.getoutput('youtube-dl --get-filename https://www.youtube.com/watch?v=BzUV9BciHe8') to = fr = "{}".format(out) print(fr) os.system('cmd /c "youtube-dl {}'.format(url))
def test_disabled_text(): a = App() t = TextBox(a, enabled=False) t.text = "text" assert t.text == "text" a.destroy()
def test_getters_setters(): a = App() t = TextBox(a) t.value = "foo" assert t.value == "foo" a.destroy()
def test_auto_layout(): a = App() w = TextBox(a) auto_layout_test(w, None) a.destroy()
def test_inherited_properties(): a = App() inherited_properties_test(a, lambda: TextBox(a), True) a.destroy()
def test_cascaded_properties(): a = App() t = TextBox(a) cascaded_properties_test(a, t, True) a.destroy()
def test_events(): a = App() t = TextBox(a) events_test(t) a.destroy()
def test_cursor_position(): a = App() t = TextBox(a, text="foo") assert t.cursor_position == 0 a.destroy()
f1 = field2.value # execute query using positional arguments cur.execute("SELECT {0} {1} FROM Country".format(f0, f1)) # clear text box text.value = "" # fetch all results and append to text box for rows in cur.fetchall(): text.append(rows) # create App app = App() # display field text boxes field1 = TextBox(app) field2 = TextBox(app) # display button and call query function button = PushButton(app, command=query) # display results text box text = TextBox(app, width=300, height=300, multiline=True, scrollbar=True) # display app window app.display() # close connection conn.close()
def test_append(): a = App() t = TextBox(a, text="foo") t.append("bar") assert t.value == "foobar" a.destroy()
# coding: utf-8 from guizero import App, Text, TextBox app = App(layout="grid") name_label = Text(app, text="Name", grid=[0,0], align="left") name = TextBox(app, grid=[1,0]) surname_label = Text(app, text="Surname", grid=[0,1], align="left") surname = TextBox(app, grid=[1,1]) dob_label = Text(app, text="Date of Birth", grid=[0,2], align="left") dob = TextBox(app, grid=[1,2]) app.display()
def test_after_schedule(): a = App() t = TextBox(a) schedule_after_test(a, t) a.destroy()
from guizero import App, Text, TextBox, PushButton, Slider, Picture def say_my_name(): welcome_message.set(my_name.get()) def change_text_size(slider_value): welcome_message.font_size(slider_value) app = App(title="Hello world") welcome_message = Text(app, text="Welcome to my app", size=28, font="Helvetica", color="red") update_text = PushButton(app, command=say_my_name, text="Display my name") my_name = TextBox(app, width=20) text_size = Slider(app, command=change_text_size, start=10, end=80) app.display()
def test_repeat_schedule(): a = App() t = TextBox(a) schedule_repeat_test(a, t) a.destroy()
["Initialise for HAL", initHal], ["Initialise for Encoder", initStandard], ["Initialise for Sensorless", initSensorless]], [["Full", fullCal], ["Motor", motorCal], ["Closed", closedLoop], ["Sensorless", sensorless], ["Encoder", encoder], ["Index", index]], [["Axis0", axis0Config], ["Axis1", axis1Config]]]) y = 0 box = Box(app, grid=[0, y]) box.width = 10 box.height = 50 y = y + 1 text = Text(app, text="current_lim", grid=[0, y]) textbox3 = TextBox(app, text=odrv0.axis0.motor.config.current_lim, grid=[1, y]) y = y + 1 #text = Text(app, text="d_axis_current (<-70.0)", grid=[0,y]) #textbox0 = TextBox(app, text = odrv0.axis0.motor.config.d_axis_current, grid=[1,y]) y = y + 1 text = Text(app, text="vel_gain", grid=[0, y]) textbox1 = TextBox(app, text=odrv0.axis0.controller.config.vel_gain, grid=[1, y]) y = y + 1 text = Text(app, text="vel_int_gain", grid=[0, y]) textbox2 = TextBox(app, text=odrv0.axis0.controller.config.vel_integrator_gain,
def test_destroy(): a = App() t = TextBox(a) destroy_test(t) a.destroy()
from guizero import App, Text, TextBox, PushButton, Picture def check_user(): if un_box.value == 'Fletcher' and pw_box.value == 'password1': message = Text(app, text='Access Granted') else: message = Text(app, text='Access Denied') app = App(title='login', bg="snow3") title = Text(app, text='My Mates Machines', color='green') message = Text(app, text='Username', color='green') un_box = TextBox(app) message1 = Text(app, text='password', color='green') pw_box = TextBox(app) Submit = PushButton(app, command=check_user, text='submit') app.display()
def test_enable(): a = App() t = TextBox(a) enable_test(t) a.destroy()
from guizero import App, Window, TextBox, Text, PushButton app = App(title="Login Screen", layout="grid") window = Window(app, title="GUI", layout="grid") window.hide() Username = "******" Password = "******" UsernameText = TextBox(app, grid=[0, 0], width="50", align="top") PasswordText = TextBox(app, grid=[0, 1], width="50", align="top", hide_text=True) def CheckCredentials(): text = Text(app, grid=[0, 2]) text.clear() if UsernameText.value == Username and PasswordText.value == Password: app.hide() window.show() else: text = Text(app, text="Incorrect Credentials", grid=[0, 3], align="top") SubmitLoginDetails = PushButton(app,
password='******', database='securehome') cursor = mariadb_connection.cursor() name = "" def say_my_name(): name = my_name.value email = my_email.value app.destroy() app = App(title="Train Face", width="500", height="150", bg='deep sky blue') welcome_message = Text(app, text="Enter a Name") my_name = TextBox(app, width="400") welcome_message2 = Text(app, text="Enter Email") my_email = TextBox(app, width="400") update_text = PushButton(app, command=say_my_name, text="OK") def convertToBinaryData(filename): # Convert digital data to binary format with open(filename, 'rb') as file: binaryData = file.read() return binaryData camera = PiCamera() camera.resolution = (640, 480) camera.framerate = 30
from guizero import App, PushButton, TextBox, Window, Text user_pw = 'letmein' user_un = 'ricky' app = App(title='Login', layout='grid') window = Window(app, title="Second Window", layout="grid") window.hide() username = TextBox(app, grid=[0, 0]) password = TextBox(app, grid=[0, 1]) def check_cred(): text = Text(app, grid=[0, 4]) text.clear() if password.value == user_pw and username.value == user_un: window.show() else: text = Text(app, text='Incorrect login!', grid=[0, 4]) submit = PushButton(app, text='SUBMIT', grid=[0, 3], command=check_cred) app.display()
filename.show() app.height = 500 def save(): savet.value = app.select_file(title="Select file", folder=".", filetypes=[["All files", "."]], save=True) savet.show() app.height = 500 #Content of main window: loadfile = PushButton(app, text="Datei wählen", command=file, width="fill") addt = Text(app, text="Additionswert:", width="fill") add = TextBox(app, width="fill") convert = PushButton(app, text="Start", command=main, width="fill") counterb = PushButton(app, text="Punkte zählen", command=counter, width="fill") copybutton = PushButton(app, text="Copyright", command=copyr, width="fill") filename = TextBox(app, text="filename", width="fill") savet = Text(app, text="save", width="fill") savet.hide() saveb = PushButton(app, text="Speichern", command=save, width="fill") exit = PushButton(app, text="Beenden", command=exit, width="fill") filename.hide() copytext = Text(win, text="Copyright by Tim Jascha Fellmeden") twitter = Text(win, text="Twitter: TimJascha") github = Text(win, text="Github: timjascha") webs = Text(win, text="Website; timjascha.com") app.display()
if password_box.value == readPwd():#admin_password: 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()
def test_color(): a = App() t = TextBox(a) color_test(t) a.destroy()