from guizero import App, TextBox, PushButton, info def subtracao(): val = float(num1.value)- float(num2.value) info("info", "a subtração resultou: {}".format(val)) app = App() num1 = TextBox(app) num2 = TextBox(app) button = PushButton(app, text="Subtração", command=subtracao) app.display()
def file_function(): print("File option") def edit_function(): print("Edit option") def exit_app(): app.destroy() file_controls = Box(app, align="top", width="fill", border=True) file_name = TextBox(file_controls, text="text_file.txt", width=50, align="left") save_button = PushButton(file_controls, text="Save", command=save_file, align="right") open_button = PushButton(file_controls, text="Open", command=open_file, align="right") exit_button = PushButton(file_controls, text="Exit", command=exit_app, align="right")
def show_playing(artist, song, files, directory, length): window = Window(app, title="Now Playing", height="320", width="480", bg="white") window.tk.attributes("-fullscreen", True) volume = pygame.mixer.music.get_volume() def next(): t.cancel() window.hide() playMusic(files, directory) t = Timer(length, next) t.start() def skip_track(): t.cancel() window.hide() playMusic(files, directory) def stop_track(): t.cancel() window.hide() pygame.mixer.music.stop() def increase_volume(): def max_invisible(): max_text.visible = False pygame.mixer.music.set_volume(pygame.mixer.music.get_volume() + 0.1) if pygame.mixer.music.get_volume() == 1.0: max_text.visible = True max_text.after(3000, max_invisible) def decrease_volume(): def min_invisible(): min_text.visible = False pygame.mixer.music.set_volume(pygame.mixer.music.get_volume() - 0.1) if pygame.mixer.music.get_volume() < 0.1: min_text.show() min_text.after(3000, min_invisible) def write_comment(): def comment_invisible(): comment_result_text.visible = False file_object = open('/home/pi/Desktop/musicboxcomments', 'a') file_object.write(str(datetime.datetime.now()) + "\n") file_object.write(comment_text.value) file_object.close() comment_result_text.show() comment_result_text.after(3000, comment_invisible) comment_text.value = "" get_comments() welcome_message = Text(window, text="--Current Track--", size=16, font="Courier New", color="black") artist_name = Text(window, text=artist, width="fill", height=2, size=14, font="Courier New", color="black") song_title = Text(window, text=song, width="fill", height=2, size=14, font="Courier New", color="black") stop_button = PushButton(window, width=75, height=75, image="/home/pi/Documents/Rideshare/stop.gif", command=stop_track, align="left") skip_button = PushButton(window, width=75, height=75, image="/home/pi/Documents/Rideshare/skip.gif", command=skip_track, align="right") volume_box = Box(window, width="fill", align="bottom", layout="grid") empty_space1 = Text(volume_box, text=" ", grid=[0, 0]) increase_button = PushButton( volume_box, width=40, height=40, image="/home/pi/Documents/Rideshare/increase.gif", command=increase_volume, grid=[3, 0]) empty_space2 = Text(volume_box, text=" ", grid=[2, 0]) decrease_button = PushButton( volume_box, width=40, height=40, image="/home/pi/Documents/Rideshare/decrease.gif", command=decrease_volume, grid=[1, 0]) max_text = Text(window, text="MAX", size=10, font="Courier New", visible=False, color="red", align="bottom") min_text = Text(window, text="MIN", size=10, font="Courier New", visible=False, color="red", align="bottom") comment_text = TextBox(window, width="20", multiline=True, height=2) comment_text_button = PushButton(window, command=write_comment, text="comment") comment_text_button.text_size = "8" comment_text_button.font = "Courier New" comment_result_text = Text(window, text="Comment saved. Thanks!", size=10, font="Courier New", visible=False, color="red", align="bottom")
faceRecogBtn.text_color = "#ffffff" ################### Add User Window Elements ############### entryWinTitleBox = Box(app, layout="grid", width="fill", align="top") addWinBackButton = PushButton(entryWinTitleBox, text="Go back", grid=[0, 0], command=showMainWin) entryPgTitle = Text(entryWinTitleBox, text="Add New User", color="blue", size=20, grid=[1, 0]) entryForm = Box(app, width="fill", layout="grid") nameLabel = Text(entryForm, text="Enter User Name", grid=[0, 0], align="left") userName = TextBox(entryForm, text="", grid=[1, 0], width="fill") idLabel = Text(entryForm, text="Enter User Id", grid=[0, 1], align="left") userId = TextBox(entryForm, text="", grid=[1, 1], width="fill") addBtnBox = Box(app, width="fill") addButton = PushButton(addBtnBox, text="Add User", command=showTestCamera) usersListBox = Box(app) usersList = ListBox(usersListBox, width="fill", items=users, scrollbar=True) deleteUserBtn = PushButton(usersListBox, text="Delete User", command=deleteSelectedUser) ################# Recognize User Window Elements ########## recogWinTitleBox = Box(app, layout="grid", width="fill", align="top") recogWinBackButton = PushButton(recogWinTitleBox, text="Go back", grid=[0, 0],
from guizero import App, TextBox, PushButton, Text, info app = App() # Function definitions for your events go here. def btn_go_clicked(): info("Greetings","Hello, " + txt_name.value + " - I hope you're having a nice day") def btn_animal_clicked(): info("Favorite Animal", "The " + txt_animal.value + " is also one of my favorite") def btn_age_clicked(): if int(txt_age.value) < 30: info("Age", "you're still young. Make the right choices") elif int(txt_age.value) > 30 and int(txt_age.value) < 60: info("Age", "Nice. you are not old yet.") else: info("Age", "You are pretty old") # Your GUI widgets go here lbl_name = Text(app, text="Hello. What's your name?") txt_name = TextBox(app) btn_go = PushButton(app, command=btn_go_clicked, text="Done") lbl_name = Text(app, text="What is your favorite animal?") txt_animal = TextBox(app) btn_go_animal = PushButton(app, command=btn_animal_clicked, text="OK") lbl_name = Text(app, text="How old are you?") txt_age = TextBox(app) btn_go = PushButton(app, command=btn_age_clicked, text="DONE") # Show the GUI on the screen app.display()
del (student_list[i]) # create the application interface from guizero import App, Text, ListBox, PushButton, TextBox, Box, Combo, yesno, error app = App(title="Student management system", layout="grid") # Set up the Box areas for our layout add_box = Box(app, grid=[0, 0], layout="grid") search_box = Box(app, grid=[1, 0]) delete_box = Box(app, grid=[2, 0]) # This section has the GUI widgets in the add_box area heading = Text(add_box, text="Add new student", grid=[0, 0]) name_lbl = Text(add_box, text="Name", grid=[0, 1]) name_text = TextBox(add_box, grid=[1, 1]) age_lbl = Text(add_box, text="Age", grid=[0, 2]) age_text = TextBox(add_box, grid=[1, 2]) phone_lbl = Text(add_box, text="Phone", grid=[0, 3]) phone_text = TextBox(add_box, grid=[1, 3]) gender_lbl = Text(add_box, text="Gender", grid=[0, 4]) gender_combo = Combo(add_box, options=["Male", "Female", "Other"], grid=[1, 4]) class_lbl = Text(add_box, text="Classes", grid=[0, 5], align="top") class_listbox = ListBox( add_box, ["GRA", "BIO", "PHY", "MAT", "DTC", "ART", "ENG", "XYZ"], grid=[1, 5], multiselect=True) add_button = PushButton(add_box, text="Add student", grid=[0, 6, 2, 1], width=20,
from guizero import App, TextBox, PushButton, Text, alerts from tkinter.font import Font def go(): alerts.info("hi", "hi " + textbox.value) app = App() text = Text(app, text="Enter your name") textbox = TextBox(app) button = PushButton(app, text="Hi", command=go) app.display()
import subprocess from docx import Document import PyPDF2 import cups global credit global counter app = App(title="Transaction Form", width=500, height=500, layout="auto") filename = "" pages = 0 pages = reader.getNumPages() file_name = Text(app, text="File Name: " + filename) nopages = Text(app, text="Number of Page(s): " + str(pages)) text2 = Text(app, text="Credits:") text3 = Text(app, text="Number of Copies: ") copies = TextBox(app) btnprint = PushButton(app, text="Print") app.display() s = sched.scheduler(time.time, time.sleep) def load_credits(sc): print("loading of credits here") s.enter(60, 1, load_credits, (s, )) s.run()
def __init__(self, master): self.master = master #Creates the application window self.space2 = Text(master, text=" ", grid=[0, 0], width="fill") self.Shapemessage1 = Text(master, size=18, text="Waveform Shape:", grid=[0, 2], align="left", font="Times") self.Waveform1 = PushButton(master, text="Normal", grid=[1, 1], width="10", command=self.show_choices1) self.Waveform2 = PushButton(master, text="Abnormal", grid=[1, 2], width="10", command=self.show_choices2) self.Waveform3 = PushButton(master, text="Leveled", grid=[1, 3], width="10", command=self.show_choices3) #self.Waveform1.toggle() #self.Waveform2.toggle() #self.Waveform3.toggle() self.combo1 = Combo( master, options=["10", "11", "12", "13", "14", "15", "16", "17"], grid=[2, 1], command=self.modelone) self.combo2 = Combo(master, options=[ "17", "18", "19", "20", "21", "22", "23", "24", "25", "26" ], grid=[2, 2], command=self.modeltwo) self.combo3 = Combo(master, options=["0"], grid=[2, 3], command=self.modelthree) self.combo1.disable() self.combo2.disable() self.combo3.disable() #Creates the three waveform buttons as well as the selection for ICP value #When the waveform selected the user is then able to select an ICP value self.space2 = Text(master, text=" ", grid=[0, 6]) #Creates space between Waveform Shape and Heart Rate self.HRmessage = Text(master, size=18, text="Heart Rate:", grid=[0, 10], align="left", font="Times") #Creates the HR subtitle self.rate = TextBox(master, grid=[1, 10]) self.HRunit = Text(master, size=15, text="BPM", grid=[2, 10], font="Times") #Creates the HR textbox to allow for typed input self.space3 = Text(master, text=" ", grid=[0, 11], font="Times") #Creates space between Heart Rate and the Update Button self.button = PushButton(master, command=self.update_value, width="12", height="10", text="Update", grid=[0, 13, 2, 2], align="bottom") #Creates an Update Button that updates the inputed information and exports the user-inputs to the next part of the program self.when_clicked = self.update_value #self.when_mouse_enters = self.update_value #Creates the update button, no new code will be executed until update button is pressed self.button = PushButton(master, command=self.calibration, width="12", height="4", text="Zero", grid=[2, 13], align="bottom") #Creates zero button which is used to calibrate self.button = PushButton(master, command=self.quit, width="12", height="4", text="Quit", grid=[2, 14], align="bottom") #Creates the quit button which will exit out of app and stop the process from running self.pid = -1 #Initialize process id
#divider for text boxes and labels info_box = Box(app, layout="grid", width=408, height=100, border=False, grid=[0, 0]) #entry box and label input_label = Text(info_box, size=24, color="black", text="Enter Decimal: ", grid=[0, 0], align="right") input_box = TextBox(info_box, width=15, grid=[1, 0]) input_box.bg = "white" #to display fractions fraction_label = Text(info_box, size=24, color="black", text="Fractional Inches: ", grid=[0, 1], align="right") fraction_answer = Text(info_box, color="black", size=24, grid=[1, 1]) #radion buttons conversion_choice = ButtonGroup(info_box, options=["Inches", "MM"], command=inches_or_mm,
macB.hide() macBB.hide() change_screens_Mac.hide() tacoA.show() tacoAA.show() tacoB.show() tacoBB.show() change_screens_Taco.show() welcome_Message.set( "Please order a Taco, or change screens for Mac & Cheese") #welcome message, followed by GUI elements tacoA = Text(app, text="Enter Taco Quantity") tacoAA = TextBox(app) tacoB = Text(app, text="Enter Taco Flavor") tacoBB = TextBox(app) macA = Text(app, text="Enter Mac Quantity") macAA = TextBox(app) macB = Text(app, text="Enter Mac Flavor") macBB = TextBox(app) macA.hide() macAA.hide() macB.hide() macBB.hide() change_screens_Taco = PushButton(app, command=tacoScreen, text="Mac & Cheese") change_screens_Mac = PushButton(app, command=macScreen, text="Tacos") change_screens_Mac.hide()
from guizero import App, Text, TextBox, PushButton, Slider, Picture def say_my_name(): welcome_message.value = my_name.get() def change_text_size(slider_value): welcome_message.size = slider_value app = App(title="Hello World", width=1000, bg="#33bbbb") welcome_message = Text(app, "welcome to my app", size="40", font="Helvetica", color="green", bg="#33bbbb") my_name = TextBox(app, width="200") update_text = PushButton(app, command=say_my_name, text="Display My Name") update_text.bg = "#33bbbb" text_size = Slider(app, command=change_text_size, start=10, end=80) text_size.bg = "#33bbbb" my_image = Picture(app, image="flower.gif") app.display
if char in alphabet: position = alphabet.find(char) newPosition = (position + (key * (-1))) % 26 newChar = alphabet[newPosition] dMessage += newChar else: dMessage += char return dMessage app = App(title="GUI Encryptor", width=250, height=180, layout="grid") # label and input for user's message txt_input = Text(app, text="Enter your message:", grid=[0, 0], align="top") message = TextBox(app, grid=[0, 1], width=41) # label and slider for an encryption key txt_key = Text(app, text="Pick a key:", grid=[0, 2], align="top") sld_key = Slider(app, grid=[0, 3], start=1, end=26, align="top") # button group to select Encryption or Decryption choice = ButtonGroup(app, options=[["Encrypt", "E"], ["Decrypt", "D"]], selected="E", horizontal=True, grid=[0, 4], align="top") # button for making things happen btn = PushButton(app, command=action, text="Do it!", grid=[0, 5], align="top")
def openAmazon(): global ISBN13 URL = "https://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=" webbrowser.open_new_tab(URL + ISBN13) app = App(title="Book Scanner", layout="grid", width=700, height=100, bg=(255, 0, 0)) info = Text(app, text="Scan or type the ISBN 13 digit code to search", enabled=True, grid=[0, 0]) input_box = TextBox(app, grid=[1, 0], width=15) input_box.focus() update = PushButton(app, command=update_details, text="Click here to search", grid=[2, 0], align="left") clear = PushButton(app, command=clear_input, text="Click to clear", grid=[2, 1], align="left") app.display()
import os, sys import networkzero as nw0 from guizero import App, Box, Text, TextBox app = App(width=400) box = Box(app) chatter = Text(box, align="top") speaking = TextBox(box, align="bottom", width=400) chatter.append("Hello\n") chatter.append("World\n") chatter.color("blue") chatter.append("!") app.display()
for i in range(0, amount): randCircle(canvas) #while True: pygame.display.flip() #update the display save_prompt() white = (255,255,255) app = App(title="Abstract Art - Circle") Text(app, text="Number of amount:", size=16) amount_input = TextBox(app, text="500") Text(app, text="File Saving", size=16) Text(app, text="Filename with full path:") fname_input = TextBox(app, text="/home/pi/Desktop/circle", width=20) Text(app, text="File type:") ftype_input = Combo(app, options=["png","jpeg","bmp","tga"]) Text(app, text="Advanced", size=16) Text(app, text="Color brightness (255 is brightest):") Slider(app, start=0, end=255, command=brightUpdate) Text(app, text="Circle size:")
app = App(title="Land Survey", width=350, height=400) #app.tk.attributes("-fullscreen", True) menubar = MenuBar(app, toplevel=["File", "Help"], options=[ [ ["New", createProject], ["Open", openProject], ["Exit", closeApp] ], [ ["About", about] ] ]) # Set up instrument height instrument_setup_box = Box(app, width="fill", align="top") text_instrument_height = Text(instrument_setup_box, text="Instrument Height:", align="left") input_instrument_height = TextBox(instrument_setup_box, text="{:.3f}".format(instrument_height), align="left") text_height_unit = Text(instrument_setup_box, text="m", align="left") button = PushButton(instrument_setup_box, text="Set", padx=20, command=setInstrumentHeight, align="right") # Measure buttons_box = Box(app, width="fill", align="bottom") button_connect = PushButton(buttons_box, text="Connect", command=connectDevice, align="left") button_measure = PushButton(buttons_box, text="Measure", command=savePoint, align="right") # Location location_box = Box(app, width="fill", align="top") location_inner_box = Box(location_box, layout="grid", align="left") ## 3D Position text_latitude = Text(location_inner_box, text="Latitude:", align="left", grid=[0,0])
print(codes) cod = int(cod) if(cod in codes): txt.show() txt2.hide() exit() else: txt2.show() txt.hide() app1 = App(title="Welcome Home", visible=False) app2 = App(title="Check the code", visible=False) box = Box(app2, align="top", width="fill") txt = Text(box, align="right", text = "Welcome home", visible=False) txt2 = Text(box, align="right", text = "Input code again", visible=False) txtBox_code = TextBox(box, align="left") but= PushButton(box, command=check_cod, text = "Check the code", align="centre") def create_app(codes, identified): if (identified==True): #app1 = App(title="Welcome Home") app1.display() else: #app2 = App(title="Check the code") app2.show() app2.display() def main(): recognizerFrontal = cv2.face.LBPHFaceRecognizer_create() recognizerFrontal.read('trainer/trainerFrontal.yml')
def displayTank(deviceData, data): #tank depth is stored in val1, i.e. deviceData[2] percentage = (int(data) / int(deviceData[2])) * 100 tankMinusPercentage = 100 - percentage d.rectangle(300, 200, 200, percentage * 2, color="green", outline=True) d.rectangle(300, percentage * 2, 200, 0, color="white", outline=True) d.text(100, 110, "Tank " + deviceData[0] + " " + str(tankMinusPercentage) + "%", color="black", size="15", max_width=100) def displayIrri(deviceData, data): #bay in which the sensor is found stored in val1 if data == "0000": writing.value = "bay " + str(deviceData[2]) + " has not detected water" elif data == "1111": writing.value = "bay " + str(deviceData[2]) + " has detected water" else: writing.value = "Unsure how to display data: " + data app = App(title="Hello world") uInput = TextBox(app) updateText = PushButton(app, command=updateValues, text="update") writing = Text(app, text="", color="black", size="20") d = Drawing(app, width=1000, height=1000) app.display()
align="left") textspace_center = Text(app, text="xxxxx", size=14, grid=[4, 5, 1, 1], align="left") textspace_center.text_color = "white" #pulse_value =Text(app, text= pulse_signal.value, size=14, grid=[4,6,1,1], align="left") #pulse_value.text_color= "black" #pulse_value.repeat(10,pulseVal) #cumulative_counting =Text(app, text="0", size=14, grid=[4,7,1,1], align="left") #cumulative_counting.text_color= "black" #cumulative_counting.repeat (10,normalCounting) # Text Box # input_target = TextBox(app, text="", grid=[1, 3, 3, 1]) input_target.text_size = 30 input_target.bg = "white" # Keypad # button1 = PushButton(app, Keypad_1, text="1", grid=[1, 4, 1, 1]) button1.bg = "black" button1.text_color = "white" button1.width = 5 button1.height = 2 button1.text_size = 15 button2 = PushButton(app, Keypad_2, text="2", grid=[2, 4, 1, 1]) button2.bg = "black" button2.text_color = "white" button2.width = 5 button2.height = 2
color=color.value, size=size.value, font=font.value) meme.text( 20, 320, bottom_text.value, color=color.value, size=size.value, font=font.value, ) # App ------------------- app = App("meme") top_text = TextBox(app, "top text", command=draw_meme) bottom_text = TextBox(app, "bottom text", command=draw_meme) color = Combo(app, options=["black", "white", "red", "green", "blue", "orange"], command=draw_meme, selected="blue") font = Combo(app, options=["times new roman", "verdana", "courier", "impact"], command=draw_meme) size = Slider(app, start=20, end=50, command=draw_meme) meme = Drawing(app, width="fill", height="fill") draw_meme()
# Create an invisible box to hold the title — useful for setting up complex layouts title_box = Box(app, width='fill', align='top') # Create the title and centre it in the application title = Text(title_box, text="Amazing Image Identifier") # Create an invisible box to hold the image and article text content_box = Box(app, width='fill', align='top') # Create an invisible box to hold the image picture_box = Box(content_box, align='left') # Create the image and set it to the start.jpg file included in this directory display_image = Picture(picture_box, image=generate_display_picture( 'start.jpg', DISPLAY_IMAGE_SIZE)) # Create the text box for article text wiki_text = TextBox(content_box, multiline=True, enabled=False, scrollbar=True, text="Please choose an image to identify.", width='fill', height='fill') # Create a box to hold the button button_box = Box(app, width='fill', align='bottom') ### End user interface code ### def update_picture(): pic = app.select_file() display_image.image = generate_display_picture(pic, DISPLAY_IMAGE_SIZE) # This line creates a button with the text 'Select picture' and tells it to run the update_picture function when clicked # It has to come later than the other interface code, as it needs the update_picture function to be created first button = PushButton(button_box, text='Select picture', command=update_picture)
debugText.value = 'good input value' else: debugText.value = 'bad input value' app = App(title="Rules UI", layout='grid', width=600, height=750) title = Text(app, text="Magic the Gathering Card Sorter", size=16, grid=[250, 10]) header_bin1 = Text(app, text="Bin 1:", size=14, grid=[2, 50]) checkbox_bin1_colour = CheckBox(app, text="Colour: ", grid=[5, 150], align='left') inputbox_bin1_colour = TextBox(app, grid=[10, 150], align='left') checkbox_bin1_set = CheckBox(app, text="Set: ", grid=[5, 160], align='left') inputbox_bin1_set = TextBox(app, grid=[10, 160], align='left') checkbox_bin1_deck = CheckBox(app, text="Deck: ", grid=[5, 170], align='left') inputbox_bin1_deck = TextBox(app, grid=[10, 170], multiline=True, align='left') checkbox_bin1_garbage = CheckBox(app, text="Garbage: ", grid=[5, 180], align='left') inputbox_bin1_garbage = TextBox(app, grid=[10, 180]) header_bin2 = Text(app, text="Bin 2:", size=14, grid=[2, 250]) checkbox_bin2_colour = CheckBox(app, text="Colour: ", grid=[5, 350], align='left') inputbox_bin2_colour = TextBox(app, grid=[10, 350], align='left')
print("X: ", coordX) print("Y: ", coordY) coordX.sort() coordY.sort() print("liste ordinate:") print("X: ", coordX) print("Y: ", coordY) print(type(coordX)) print(type(coordY)) plt.plot(coordX, coordY) plt.ylabel('some numbers') plt.show() app = App(title='interfaccia') hello_text = Text(app, text='interfaccia', font='Arial', size=40) whatever = TextBox(app, width=30, multiline=True, height=2) whatever.value = 'interfaccia/grafico' push = PushButton(app, text='grafico', command=bottone0) push.width = 8 push.height = 3 app.display()
submit_box = Box( app, width='fill', align='bottom' ) # box containing test pattern & cycles inputs & submit button submit_box.bg = 'sky blue' test_pattern = Text(submit_box, text='Test pattern:', height='2', size=-12) # test pattern input text pattern = ButtonGroup( submit_box, # test pattern button group input (initially disabled) options=[['Simultaneous ', '3'], ['Small motor first ', '1'], ['Big motor first ', '2']], horizontal=True, enabled=False) total_cycles = Text(submit_box, text='Number of cycles:', height='2', size=-12) # test cycles input text cycles = TextBox( submit_box, text='0', enabled=False) # test cycles textbox input (initially disabled) cycles.tk.config(justify='center') # access tkinter object to center text total = 0 # total test cycles variable blank_3 = Text(submit_box, size=-12) # spacer submit_button = PushButton( submit_box, command=submit, text='Submit', enabled=False ) # submit parameters button calls submit function (initially disabled) submit_button.bg = 'light gray' blank_4 = Text(submit_box, size=-12) # spacer sm_mot_box = Box(app, height='fill', width='fill', align='left') # box containing small motor parameter inputs sm_mot_box.bg = 'sky blue' sm_mot_on = CheckBox( sm_mot_box, text='Small motor active ', command=mot_activity
from guizero import App, TextBox def highlight(): text_box.bg = "lightblue" def lowlight(): text_box.bg = "white" app = App() text_box = TextBox(app) # When the mouse enters the TextBox text_box.when_mouse_enters = highlight # When the mouse leaves the TextBox text_box.when_mouse_leaves = lowlight app.display()
def onclick_code(): del_main() global input_text global numpad txt_sz = 25 #button text size num_padx = 55 # x axis padding for numbers input_text = TextBox(main_box, width=40) numpad = Box(main_box, layout="grid") #cols should have similar padding for numbers #col 1 box_7 = PushButton(numpad, grid=[0, 0], text="7", padx=num_padx, pady=15, command=onclick_7) box_4 = PushButton(numpad, grid=[0, 1], text="4", padx=num_padx, pady=15, command=onclick_4) box_1 = PushButton(numpad, grid=[0, 2], text="1", padx=num_padx, pady=15, command=onclick_1) box_clear = PushButton(numpad, grid=[0, 3], text="CLEAR", padx=12, pady=15, command=onclick_del) box_7.text_size = txt_sz box_4.text_size = txt_sz box_1.text_size = txt_sz box_clear.text_size = txt_sz box_8 = PushButton(numpad, grid=[1, 0], text="8", padx=num_padx, pady=15, command=onclick_8) box_5 = PushButton(numpad, grid=[1, 1], text="5", padx=num_padx, pady=15, command=onclick_5) box_2 = PushButton(numpad, grid=[1, 2], text="2", padx=num_padx, pady=15, command=onclick_2) box_0 = PushButton(numpad, grid=[1, 3], text="0", padx=num_padx, pady=15, command=onclick_0) box_8.text_size = txt_sz box_5.text_size = txt_sz box_2.text_size = txt_sz box_0.text_size = txt_sz box_9 = PushButton(numpad, grid=[2, 0], text="9", padx=num_padx, pady=15, command=onclick_9) box_6 = PushButton(numpad, grid=[2, 1], text="6", padx=num_padx, pady=15, command=onclick_6) box_3 = PushButton(numpad, grid=[2, 2], text="3", padx=num_padx, pady=15, command=onclick_3) box_enter = PushButton(numpad, grid=[2, 3], text="ENTER", pady=15, command=onclick_enter) box_9.text_size = txt_sz box_6.text_size = txt_sz box_3.text_size = txt_sz box_enter.text_size = txt_sz
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", width=20, height=2) text_box = TextBox(app, "some text", width=50) slider = Slider(app, width=300, height=30) button = PushButton(app, width=20, height=2) pic = Picture(app, image="guizero.gif", width=400, height=50) combo = Combo(app, ["martin", "laura", "rik"], width=50, height=2) check = CheckBox(app, "tick me", width=17, height=2) button_group = ButtonGroup(app, ["cheese", "onion", "crisps"], 1, width=35, height=9) button_group.bg = "darkgrey" box = Box(app, width=100, height=100) box.border = True box.bg = "red" app.display()
from guizero import App, Text, warn, TextBox, PushButton, info from time import sleep GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) GPIO.setup(8, GPIO.OUT) GPIO.setup(16, GPIO.OUT) GPIO.setup(10, GPIO.OUT) pwm = GPIO.PWM(8, 50) pwm.start(0) app = App(title="TREASURE BOX", height=280, width=600) message = Text(app, text="\n\n Please Enter your password to Login ! \n", size=18, font="Arial") my_input = TextBox(app) def do_nothing(): c = my_input.get() if c == "treasure": info("BEST", "You are welcomed !") pwm.ChangeDutyCycle(4) GPIO.output(16, GPIO.HIGH) sleep(3) GPIO.output(16, GPIO.LOW) else: warn("BAD!", "Please Try again !") GPIO.output(10, GPIO.HIGH) sleep(3)
app = App(title="Hello world", layout='auto', height=150) vertical_box = Box(app, layout='grid') horizontal_box0 = Box(vertical_box, layout='grid', grid=(0, 0)) horizontal_box1 = Box(vertical_box, layout='grid', grid=(1, 0)) horizontal_box2 = Box(vertical_box, layout='grid', grid=(2, 0)) horizontal_box3 = Box(vertical_box, layout='grid', grid=(3, 0)) horizontal_box4 = Box(vertical_box, layout='grid', grid=(4, 0)) input_path_widget = PushButton( horizontal_box0, text="Choose file...", command=choose_file, grid=(0, 0), ) message_secret = Text(horizontal_box1, "Secret message: ", grid=(0, 0)) text_box_secret = TextBox(horizontal_box1, text='', width=20, grid=(0, 1)) save_file_widget = PushButton(horizontal_box1, text="Save stego-file...", command=save_file, grid=(0, 2)) hidden_data_text = Text(horizontal_box2, "", grid=(0, 0)) hidden_data_red_text = Text(horizontal_box2, "", grid=(0, 1), color='red') key_inpu_text = Text(horizontal_box3, "Key: ", grid=(0, 0)) key_input = TextBox(horizontal_box3, "", grid=(0, 1)) app.display()