class NewTask(): '''NewTask GUI''' def __init__(self, app, callback): '''Class contructor''' self.callback = callback self.window_new = Window(app, title="Add Task") Text(self.window_new, "Add new task title") self.title = TextBox(self.window_new, command=self.check_empty, width="fill") Text(self.window_new, "Add new task description") self.desc_box = Box(self.window_new, align="top", width="fill", height="fill", border=True) self.btn_box = Box(self.window_new, align="bottom", width="fill", border=True) self.description = TextBox(self.desc_box, command=self.check_empty, width="fill", height="fill", multiline=True, scrollbar=True) PushButton(self.btn_box, command=self.window_new.destroy, align="left", width="fill", text="Cancel") self.add_btn = PushButton(self.btn_box, enabled=False, align="left", width="fill", command=self.add_task, text="Add") self.window_new.tk.resizable(True, False) self.window_new.show() def check_empty(self): '''disable add button if title and description are empty''' if self.title.value != "" and self.description.value != "\n": self.add_btn.enable() else: self.add_btn.disable() def add_task(self): '''callback with new title and description''' self.callback(self.title.value, self.description.value) self.window_new.destroy()
def drill_4_selection(): second_message.value = "Predictive Passing Selected" window4 = Window(app, bg="darkgreen") welcome_message4 = Text(window4, "Predictive Passing Parameters", size=25, font="Times New Roman", color="black") start_4 = PushButton(window4, command=powerON, text="Start") pause_4 = PushButton(window4, command=powerON, text="Pause") start_4.width = 30 start_4.bg = "gray" pause_4.width = 30 pause_4.bg = "gray" #second_message4 = Text(window4, "How many targets would you like to use?", size=15, font="Times New Roman", color="black") #targets = Slider(window4, command=print("Okay"), start=1, end=4) third_message4 = Text(window4, "Please select a passing speed:", size=15, font="Times New Roman", color="black") ball_speed4 = Slider(window4, command=print("Okay"), start=1, end=10) ball_speed4.width = 300
def test_enable(): a = App() w = Window(a) t = Text(w) cascading_enable_test(a) cascading_enable_test(w) a.destroy()
def update_details(): global ISBN13 book = input_box.value book_meta = isbnlib.meta(book) description = isbnlib.desc(book) title = book_meta["Title"] author = book_meta["Authors"][0] year = book_meta["Year"] ISBN13 = book_meta["ISBN-13"] details = Window(app, title=title + " " + author, width=700, layout="grid") Publication_Title = Text(details, text="Book Title: " + title, grid=[0, 1], align="left") Author_Details = Text(details, text="Author(s): " + author, grid=[0, 2], align="left") Publication_Year = Text(details, text="Year of publication: " + year, grid=[0, 3], align="left") ISBN13Data = Text(details, text="ISBN-13: " + ISBN13, grid=[0, 4], align="left") Description = Text(details, text="Description: " + description, grid=[0, 5], align="left") Visit_Amazon = PushButton(details, text="Visit Amazon", command=openAmazon, grid=[0, 8], align="left")
def open_habitat_window(): app.hide() # hide main window #Habitat window code and widgets habitat_window = Window(app, title="Habitat") Text(habitat_window, text="") picture = Picture(habitat_window, image="images/geograph-1619354-by-N-Chadwick.png") Text(habitat_window, text="") arrival_Button = PushButton(habitat_window, text='Take an arrival card', command=take_arrival_card) habitatList = (habitats(db)) Text(habitat_window, text="Player #") player_num = Combo(habitat_window, options=[1, 2, 3, 4, 5, 6]) Text(habitat_window, text="Select habitat") habitat_dropdown = Combo(habitat_window, options=habitatList) Text(habitat_window, text="Number of birds spotted: ") num_spottings = Combo(habitat_window, options=[3, 1, 2, 4, 5, 6]) confirm_Button = PushButton( habitat_window, text='Start Spotting!', command=habitat_bird, args=[habitat_window, player_num, habitat_dropdown, num_spottings]) cancel_Button = PushButton(habitat_window, text='Cancel', command=cancel_habitat_window, args=[habitat_window])
def _generate_info(self): """ generate info view after push "how to?" button """ window = Window(self.app, width=250, height=180, title="how to use") instruction = Text(window, text=info_text_message, align="left") instruction.text_size = 8
def user_input(self, appname): from guizero import Box appname = appname # second_message.value = "User Input Selected" self.window4 = Window(app, bg="#424242", height=280, width=480,layout="grid") Text(self.window4, "User Input Mode", size=18, font="Calibri Bold", color="white",grid=[1,0]) Text(self.window4, "Please select a distance:", size=14, font="Calibri Bold", color="white",grid=[1,1]) distance = Slider(self.window4, command=self.distance_slider, start=5, end=25,grid=[1,2]) distance.text_size=14 Box(self.window4,width=100,height=10,grid=[1,3]) distance.bg="white" self.textbox = TextBox(self.window4,grid=[0,4,3,1]) self.textbox.width = 40 self.textbox.bg = "white" self.textbox.text_size=14 Box(self.window4,width=100,height=10,grid=[1,5]) send = PushButton(self.window4, command=self.send_data, args=[], image="include/images/startbut.png",grid=[1,6]) # send.width = 30 send.bg="#37f100" left = PushButton(self.window4,command=self.left_curve,args=[],text="Left",grid=[0,6]) right = PushButton(self.window4,command=self.right_curve,args=[],text="Right",grid=[2,6]) exit = PushButton(self.window4, command=self.close_test, args=[self.window4], image="include/images/stopbut.png",grid=[1,7]) exit.bg = "#e9002a"
def reservation_error(): #success reservation window function #a function to create reservation displays window_err = Window(app,title=" ", height=100, width=400) #Box for choosing starting time to reserve text = Text(window_err, text= "ID Unrecognized. No rights to reserved", align="top")
def axis0Config(): window = Window(app, title="Axis0 Config", height=970, width=800) txt = "odrv0." + "\n------\n" + str(odrv0) + "\n\n" txt += "axis0." + "\n------\n" + str(odrv0.axis0) + "\n\n" txt += "motor current control." + "\n----------------------\n" + str( odrv0.axis0.motor.current_control) + "\n\n" txt += "motor gate driver." + "\n------------------\n" + str( odrv0.axis0.motor.gate_driver) + "\n\n" txt += "motor timing log." + "\n------------------\n" + str( odrv0.axis0.motor.timing_log) + "\n\n" txt += "motor config." + "\n-----------\n" + str( odrv0.axis0.motor.config) + "\n\n" txt += "controller config." + "\n------------------\n" + str( odrv0.axis0.controller.config) + "\n\n" txt += "encoder config." + "\n------------------\n" + str( odrv0.axis0.encoder.config) + "\n\n" txt += "sensorless estimator config." + "\n-----------------------------\n" + str( odrv0.axis0.sensorless_estimator.config) + "\n\n" txt += "trap traj config." + "\n------------------\n" + str( odrv0.axis0.trap_traj.config) textbox = TextBox(window, text=txt, multiline=True, width=200, height=60, scrollbar=True)
def music_window(): window = Window(app, title="Music setting") window.bg = (156, 153, 153) Play = PushButton(window, text="Play", command=start_music, width="fill") Pause = PushButton(window, text="Pause", command=pause_music, width="fill") Continue = PushButton(window, text="Continue", command=continue_music, width="fill") next_ = PushButton(window, text="next", command=next_music, width="fill") previous = PushButton(window, text="previous", command=previous_music, width="fill") text_slider = Text(window, text="volume", width="fill") music_volume = Slider(window, command=volume, width="fill")
def drill_1_selection(): second_message.value = "Target Drill Selected" window1 = Window(app, bg="darkgreen") welcome_message1 = Text(window1, "Target Drill Parameters", size=25, font="Times New Roman", color="black") start_1 = PushButton(window1, command=drill_1_selection, text="Start") pause_1 = PushButton(window1, command=drill_2_selection, text="Pause") start_1.width = 30 start_1.bg = "gray" pause_1.width = 30 pause_1.bg = "gray" second_message1 = Text(window1, "How many targets would you like to use?", size=15, font="Times New Roman", color="black") targets = Slider(window1, command=print("Okay"), start=1, end=4) third_message1 = Text(window1, "Please select a passing speed:", size=15, font="Times New Roman", color="black") ball_speed = Slider(window1, command=print("Okay"), start=1, end=10) ball_speed.width = 300
def test_alt_values(): a = App() w = Window(a, title="foo", width=666, height=666, layout="grid") assert w.title == "foo" assert w.width == 666 assert w.height == 666 assert w.layout == "grid" a.destroy()
def test_default_values(): a = App() w = Window(a) assert w.title == "guizero" assert w.width == 500 assert w.height == 500 assert w.layout == "auto" a.destroy()
def __init__(self): self.capture_number = self.timestamp() self.video_capture_number = self.timestamp() self.picture_index = 0 self.saved_pictures = [] self.shown_picture = "" GPIO.setwarnings(False) # Ignore warning for now GPIO.setmode(GPIO.BCM) # set up BCM GPIO numbering GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.add_event_detect(16, GPIO.FALLING, callback=self.takePicture, bouncetime=2500) self.app = App(layout="grid", title="Camera Controls", bg="black", width=480, height=320) text0 = Text(self.app,color="white", grid=[1,0], text="- PiDSLR -") button1 = PushButton(self.app, grid=[1,1], width=110, height=110, pady=35, padx=10, image="/home/pi/piDSLR/icon/prev.png", command=self.long_preview) text1 = Text(self.app, color="white", grid=[1,2],text="Focus") button2 = PushButton(self.app, grid=[3,1], width=110, height=110, pady=35, padx=10, image="/home/pi/piDSLR/icon/gallery.png", command=self.show_gallery) text2 = Text(self.app, color="white", grid=[3,2],text="Gallery") button3 = PushButton(self.app, grid=[5,1], width=110, height=110, pady=35, padx=10, image="/home/pi/piDSLR/icon/vid.png", command=self.video_capture) text2 = Text(self.app, color="white", grid=[5,2],text="HD 30s") button4 = PushButton(self.app, grid=[7,1], width=110, height=110, pady=35, padx=10, image="/home/pi/piDSLR/icon/lapse.png", command=self.burst) text3 = Text(self.app, color="white", grid=[7,2],text="Burst") button5 = PushButton(self.app, grid=[1,3], width=110, height=110, image="/home/pi/piDSLR/icon/self.png", command=self.lapse) text4 = Text(self.app, color="white", grid=[1,4],text="1h 60pix") button6 = PushButton(self.app, grid=[3,3], width=110, height=110, image="/home/pi/piDSLR/icon/long.png", command=self.split_hd_30m) text2 = Text(self.app, color="white", grid=[3,4],text="HD 30m in 5s") button7 = PushButton(self.app, grid=[5,3], width=110, height=110, image="/home/pi/piDSLR/icon/drop.png", command=self.upload) text3 = Text(self.app, color="white", grid=[5,4],text="Upload") button8 = PushButton(self.app, grid=[7,3], width=110, height=110, image="/home/pi/piDSLR/icon/del.png", command=self.clear) text4 = Text(self.app, color="white", grid=[7,4],text="Clear Folder") self.busy = Window(self.app, bg="red", height=175, width=480, title="busy") self.app.tk.attributes("-fullscreen", True) self.busy.hide() self.app.display()
def picp(): picw = Window(welcome, title="Debian Max Pictures") pithanks = Text(picw, text="Made Possible by Raspberry Pi and Raspibian", size=10, font="Times New Roman", color="red") pi = Picture(picw, image="1436.gif") raspb = Picture(picw, image="rasp.gif")
def __init__(self): self.smidgen_number = 0 self.pinch_number = 0 self.dash_number = 0 self.teaspoon_number = 0 self.dispensing_id = Spices.SALT # Default: id is salt (0) self.dispensing_id_text = SALT_DISPENSING_TEXT # Default: salt self.dispensing_amount = 0 self.dispensing_flag = False self.app = App(title="Pestle Co.") # All code must be added in th event loop # START self.option_window = Window(self.app, title="Choosing a spice") self.option_window.hide() # hide this window for now self.dispensing_window = Window(self.option_window, title="Dispensing") self.dispensing_window.hide() # hide this window for now self.app.set_full_screen() self.welcome_message = Text(self.app, text="Pestle Co.", size=40, font="Times New Roman", color="blue") self.start_button = PushButton(self.app, command=self.open_option_window, text="Push to Start") # Option page self.salt_button = PushButton(self.option_window, command=self.open_salt_dispensing_window, text="Salt", align="top") self.pepper_button = PushButton(self.option_window, command=self.open_pepper_dispensing_window, text="Pepper", align="top") self.done_button = PushButton(self.option_window, command=self.close_option_window, text="Done", align="bottom") # Dispensing page self.dispensing_text = Text(self.dispensing_window, text=self.dispensing_id_text) self.smidgen_button = PushButton(self.dispensing_window, command=self.add_a_smidgen, text="Smidgen") self.smidgen_number_text = Text(self.dispensing_window, text=str(self.smidgen_number) + " Smidgen(s)") self.pinch_button = PushButton(self.dispensing_window, command=self.add_a_pinch, text="Pinch") self.pinch_number_text = Text(self.dispensing_window, text=str(self.pinch_number) + " Pinch(es)") self.dash_button = PushButton(self.dispensing_window, command=self.add_a_dash, text="Dash") self.dash_number_text = Text(self.dispensing_window, text=str(self.dash_number) + " Dash(es)") self.teaspoon_button = PushButton(self.dispensing_window, command=self.add_a_teaspoon, text="Teaspoon") self.teaspoon_number_text = Text(self.dispensing_window, text=str(self.teaspoon_number) + " Teaspoon(s)") self.dispense_button = PushButton(self.dispensing_window, command=self.final_dispense, text="Dispense", align="bottom") self.reset_button = PushButton(self.dispensing_window, command=self.reset_measurement, text="Reset", align="bottom") # STOP self.app.display()
def test_getters_setters(): a = App() w = Window(a) w.title = "bar" assert w.title == "bar" w.bg = "red" assert w.bg == "red" w.height = 666 assert w.height == 666 w.width = 666 assert w.width == 666 w.destroy()
def StartTwoPlayer(): global twoPlayerWindow global drawButtonTwoPlayer global cardImagesTwoPlayer1 global cardImagesTwoPlayer2 global guessContainerTwoPlayer1 global guessContainerTwoPlayer2 global guessTextBoxTwoPlayer1 global guessTextBoxTwoPlayer2 global guessCheckButtonTwoPlayer global correctTwoPlayer1 global correctTwoPlayer2 global errorTextTwoPlayer twoPlayerWindow = Window(app, title="Two Player Game", layout="grid") twoPlayerWindow.width = 660; twoPlayerWindow.height = 570; twoPlayerWindow.bg = "Lime" drawButtonTwoPlayer = PushButton(twoPlayerWindow, text="Draw!", grid=[0, 0], align="top", padx=20, command=ButtonSwapTwoPlayer) drawButtonTwoPlayer.width = 20; drawButtonTwoPlayer.height = 5; drawButtonTwoPlayer.bg = "White" cardImagesTwoPlayer1 = Box(twoPlayerWindow, layout="grid", grid=[0, 1], align="top", border=True) cardImagesTwoPlayer1.set_border(5, "Lime") cardImagesTwoPlayer2 = Box(twoPlayerWindow, layout="grid", grid=[1, 1], align="top", border=True) cardImagesTwoPlayer2.set_border(5, "Lime") guessContainerTwoPlayer1 = Box(twoPlayerWindow, layout="grid", grid=[0, 2], align="top", border=True) guessContainerTwoPlayer1.set_border(10, "Lime") guessTextBoxTwoPlayer1 = TextBox(guessContainerTwoPlayer1, grid=[0, 0], align="top") guessTextBoxTwoPlayer1.text_size = 20; guessTextBoxTwoPlayer1.bg = "White"; guessTextBoxTwoPlayer1.disable() guessContainerTwoPlayer2 = Box(twoPlayerWindow, layout="grid", grid=[1, 2], align="top", border=True) guessContainerTwoPlayer2.set_border(10, "Lime") guessTextBoxTwoPlayer2 = TextBox(guessContainerTwoPlayer2, grid=[0, 0], align="top") guessTextBoxTwoPlayer2.text_size = 20; guessTextBoxTwoPlayer2.bg = "White"; guessTextBoxTwoPlayer2.disable() pointsTextTwoPlayer1 = Text(guessContainerTwoPlayer1, text="Player One Score: ", grid=[0, 2], align="top") pointsTextTwoPlayer2 = Text(guessContainerTwoPlayer2, text="Player Two Score: ", grid=[0, 2], align="top") guessCheckButtonTwoPlayer = PushButton(twoPlayerWindow, text="Check!", grid=[0, 3], align="top", command=CheckValuesTwoPlayer) guessCheckButtonTwoPlayer.width = 20; guessCheckButtonTwoPlayer.height = 5; guessCheckButtonTwoPlayer.bg = "White"; guessCheckButtonTwoPlayer.disable() correctTwoPlayer1 = Text(guessContainerTwoPlayer1, text="", grid=[0, 3]) correctTwoPlayer2 = Text(guessContainerTwoPlayer2, text="", grid=[0, 3]) errorTextTwoPlayer = Text(twoPlayerWindow, text="Please Enter a Number!", grid=[0, 4]) errorTextTwoPlayer.hide()
def copy(): copy_window = Window(json_editor_window, title="create a copy") copy_window.show(wait=True) Text(copy_window, text="Name of copy :") file_name = TextBox(copy_window, text=file_display.value, enabled=True, width="fill") file_name.when_left_button_released = text_click def complete_copy(): destination = file_name.value save(0, destination) copy_window.destroy() ok_button = PushButton(copy_window, text="OK", command=complete_copy) cancel_button = PushButton(copy_window, text="cancel", command=copy_window.destroy)
def staticDrill(self,appname): from guizero import Box appname = appname # second_message.value = "Static Passing Selected" self.drillType = "Static" self.window1 = Window(app, bg="#424242",height=280, width=480, layout="grid") # logo = Picture(self.window1, image="include/logo.gif", align="left", grid=[0, 0]) # logo.resize(40, 40) Heading = Text(self.window1, "Basic Tracking", size=18, font="Calibri Bold", color="white",grid=[1,0,3,1]) Slide1 = Text(self.window1, "Ball Speed:", size=14, font="Calibri Bold", color="white", grid=[1, 1]) # , 2, 1]) speed = Slider(self.window1, command=self.ball_speed_slider, start=1, end=5, grid=[1, 2]) speed.width = 150 speed.text_color = "black" speed.bg = "white" speed.text_size=14 Slide2 = Text(self.window1, "Pass Difficulty:", size=14, font="Calibri Bold", color="white", grid=[3, 1]) difficulty = Slider(self.window1, command=self.difficulty_slider, start=1, end=5, grid=[3, 2]) difficulty.width = 150 difficulty.text_color = "black" difficulty.bg = "white" difficulty.text_size=14 start = PushButton(self.window1, command=self.start_command, args=[self.ballSpeed, self.difficulty, self.drillType, appname], image="include/images/startbut.png", grid=[1, 5]) start.bg = "#37f100" start.text_color = "white" stop = PushButton(self.window1, command=self.pause_command, args=[self.window1], image="include/images/pausebut.png", grid=[3, 5]) stop.bg = "#ffb000" stop.text_color = "white" exit_win = PushButton(self.window1, command=self.exit_command, args=[appname, self.window1], image="include/images/stopbut.png", grid=[1, 6]) exit_win.bg = "#e9002a" exit_win.text_color = "white" camera = PushButton(self.window1, command=self.show_cam, args=[], image="include/images/camerabut.png", grid=[3, 6]) camera.bg = "#002ff5" camera.text_color = "white" Center = Box(self.window1, width=50, height=165, grid=[2, 1, 1, 7]) Left = Box(self.window1, width=60, height=200, grid=[0, 0, 1, 7]) Right = Box(self.window1, width=20, height=200, grid=[4, 0, 1, 7]) VC = PushButton(Center, command=self.enable_voice, args=[], image="include/images/micbut.png", align="bottom")
def reservation_success(): #success reservation window function global window_reserv #hide reservation window window_reserv.hide() #a function to create reservation displays window = Window(app,title=" ", height=100, width=400) #Box for choosing starting time to reserve text = Text(window, text= "Reservation success!", align="top")
def EndScreenOnePlayer(): global endOnePlayerWindow global playerOnePoints endOnePlayerWindow = Window(app, title="One Player End Screen", layout="grid") endOnePlayerWindow.width = 300; endOnePlayerWindow.height = 300; endOnePlayerWindow.bg = "Lime" gameOverOnePlayer = Text(endOnePlayerWindow, text="Game Over!", grid=[0, 0], align="top") gameOverOnePlayer.text_size = 40 yourScoreTextOnePlayer = Text(endOnePlayerWindow, text="Your Score", grid=[0, 1], align="top") yourScoreTextOnePlayer.text_size = 20 displayedScoreOnePlayer = Text(endOnePlayerWindow, text=playerOnePoints, grid=[0, 2], align="top") displayedScoreOnePlayer.text_size = 30 outOfOnePlayer = Text(endOnePlayerWindow, text="Out Of", grid=[0, 3], align="top") outOfOnePlayer.text_size = 20 onePlayerMaxScore = Text(endOnePlayerWindow, text="26", grid=[0, 4], align="top") onePlayerMaxScore.text_size = 30 restartButton = PushButton(endOnePlayerWindow, grid=[0, 5], text="Play Again", align="top", command=RestartGame) restartButton.bg = "White"
def SQLQueriesExecution(queryString, informationData): printData = [] dataWindow = Window(app, title="Query Display", layout="grid") dataWindow.height = 1080 dataWindow.width = 400 dataWindow.bg = "Grey" dataRecord = connection.execute(queryString) printData.append(informationData) for row in dataRecord: printData.append(row) dataList = ListBox(dataWindow, items=printData, scrollbar=True, grid=[0, 0], align="top") dataList.height = 1080 dataList.width = 400 dataList.bg = "White"
def shatnew(): shatw = Window(pqtm, title = "Sense Hat (Dev)") xpixel = Text(shatw, text = "X Pixel:") pixelx = TextBox(shatw) ypixel = Text(shatw, text = "Y Pixel:") pixely = TextBox(shatw) rt = Text(shatw, text = "Red value:") red = TextBox(shatw) yt = Text(shatw, text = "Green Value:") green = TextBox(shatw) bt = Text(shatw, text = "Blue value:") blue = TextBox(shatw)
def EndScreenTwoPlayer(): global endTwoPlayerWindow global playerOnePoints global playerTwoPoints endTwoPlayerWindow = Window(app, title="Two Player End Screen", layout="grid") endTwoPlayerWindow.width = 550; endTwoPlayerWindow.height = 350; endTwoPlayerWindow.bg = "Lime" gameOverTwoPlayer = Text(endTwoPlayerWindow, text="Game Over!", grid=[0, 0], align="top") gameOverTwoPlayer.text_size = 40 yourScoreTextTwoPlayer1 = Text(endTwoPlayerWindow, text="Player One Score", grid=[0, 1], align="top") yourScoreTextTwoPlayer1.text_size = 20 displayedScoreTwoPlayer1 = Text(endTwoPlayerWindow, text=playerOnePoints, grid=[0, 2], align="top") displayedScoreTwoPlayer1.text_size = 30 outOfTwoPlayer1 = Text(endTwoPlayerWindow, text="Out of", grid=[0, 3], align="top") outOfTwoPlayer1.text_size = 20 twoPlayerMaxScore1 = Text(endTwoPlayerWindow, text="13", grid=[0, 4], align="top") twoPlayerMaxScore1.text_size = 30 yourScoreTextTwoPlayer2 = Text(endTwoPlayerWindow, text="Player Two Score", grid=[1, 1]) yourScoreTextTwoPlayer2.text_size = 20 displayedScoreTwoPlayer2 = Text(endTwoPlayerWindow, text=playerTwoPoints, grid=[1, 2], align="top") displayedScoreTwoPlayer2.text_size = 30 outOfTwoPlayer2 = Text(endTwoPlayerWindow, text="Out of", grid=[1, 3], align="top") outOfTwoPlayer2.text_size = 20 twoPlayerMaxScore2 = Text(endTwoPlayerWindow, text="13", grid=[1, 4], align="top") twoPlayerMaxScore2.text_size = 30 competitionText = Text(endTwoPlayerWindow, text="", grid=[0, 5], align="top") competitionText.text_size = 20; competitionText.hide() if (playerOnePoints > playerTwoPoints): competitionText = Text(endTwoPlayerWindow, text="Player 1 Wins!", grid=[0, 5], align="top"); competitionText.text_size = 20; elif (playerOnePoints < playerTwoPoints): competitionText = Text(endTwoPlayerWindow, text="Player 2 Wins!", grid=[0, 5], align="top"); competitionText.text_size = 20; elif (playerOnePoints == playerTwoPoints): competitionText = Text(endTwoPlayerWindow, text="It's a Draw!", grid=[0, 5], align="top"); competitionText.text_size = 20; restartButton = PushButton(endTwoPlayerWindow, grid=[0, 6], text="Play Again!", align="top", command=RestartGame) restartButton.bg = "White"
def manualDrill(self,appname): # if self.player != "None": from guizero import Box appname = appname # second_message.value = "Entering Manual Mode" self.drillType = "Manual" self.window3 = Window(app, bg="#424242",height=280, width=480, layout="grid") # logo = Picture(self.window3, image="include/logo.gif", align="left", grid=[0, 0]) # logo.resize(75, 75) Heading = Text(self.window3, "Voice Activated Launch", size=18, font="Calibri Bold", color="white",grid=[1,0,3,1]) Slide1 = Text(self.window3, "Ball Speed:", size=14, font="Calibri Bold", color="white", grid=[1, 1]) # , 2, 1]) speed = Slider(self.window3, command=self.ball_speed_slider, start=1, end=5, grid=[1, 2]) speed.width = 150 speed.text_color = "black" speed.bg = "white" speed.text_size=14 Slide2 = Text(self.window3, "Pass Difficulty:", size=14, font="Calibri Bold", color="white", grid=[3, 1]) difficulty = Slider(self.window3, command=self.difficulty_slider, start=1, end=5, grid=[3, 2]) # , 2, 1]) difficulty.width = 150 difficulty.text_color = "black" difficulty.bg = "white" difficulty.text_size=14 start = PushButton(self.window3, command=self.start_command, args=[self.ballSpeed, self.difficulty, self.drillType, appname], image="include/images/startbut.png", grid=[1, 5]) start.bg = "#37f100" start.text_color = "white" stop = PushButton(self.window3, command=self.pause_command, args=[self.window3], image="include/images/pausebut.png", grid=[3, 5]) stop.bg = "#ffb000" stop.text_color = "white" exit_win = PushButton(self.window3, command=self.exit_command, args=[appname, self.window3], image="include/images/stopbut.png", grid=[1, 6]) exit_win.bg = "#e9002a" exit_win.text_color = "white" camera = PushButton(self.window3, command=self.show_cam, args=[], image="include/images/camerabut.png", grid=[3, 6]) camera.bg = "#002ff5" camera.text_color = "white" Center = Box(self.window3, width=50, height=200, grid=[2, 1, 1, 7]) Left = Box(self.window3, width=60, height=200, grid=[0, 0, 1, 7]) Right = Box(self.window3, width=20, height=200, grid=[4, 0, 1, 7])
def splashscreen(): #show splashscreen splashwindow = Window(app, "Erelas monitoring system", width=450, height = 100) splashtext = Text(splashwindow, text="Device status monitored by Erelas monitoring system") splashtext2 = Text(splashwindow, text = "https://github.com/moth754/Erelas-Local-Monitor") splashwindow.show() sleep(3) splashwindow.hide()
def conn(): sIP = ipBox.value sP = portBox.value try: s.connect((sIP, int(sP))) s.settimeout(0.01) s.send(nick.encode('utf-8')) chatHist.repeat(150, getData) except: errWin = Window(app, title="Unable to connect.", width=200, height=50) Text(errWin, text="Unable to connect to " + str(sIP) + " on port " + str(sP)) PushButton(errWin, text="Ok", command=errWin.hide)
def __init__(self, app, callback): '''Class contructor''' self.callback = callback self.window_new = Window(app, title="Add Task") Text(self.window_new, "Add new task title") self.title = TextBox(self.window_new, command=self.check_empty, width="fill") Text(self.window_new, "Add new task description") self.desc_box = Box(self.window_new, align="top", width="fill", height="fill", border=True) self.btn_box = Box(self.window_new, align="bottom", width="fill", border=True) self.description = TextBox(self.desc_box, command=self.check_empty, width="fill", height="fill", multiline=True, scrollbar=True) PushButton(self.btn_box, command=self.window_new.destroy, align="left", width="fill", text="Cancel") self.add_btn = PushButton(self.btn_box, enabled=False, align="left", width="fill", command=self.add_task, text="Add") self.window_new.tk.resizable(True, False) self.window_new.show()
def student_details(): ''' Display student details in a new window. ''' details = Window(app, title=class_listbox.value, width=350, height=150) name_label = Text(details) age_label = Text(details) phone_label = Text(details) classes_label = Text(details, text="Classes: ") for student in student_list: if class_listbox.value == student.get_name(): name_label.value = "Name: " + student.get_name() age_label.value = "Age: " + str(student.get_age()) phone_label.value = "Phone: " + str(student.get_phone()) student_classes = student.get_classes() for c in student_classes: classes_label.value += c + " "
admin_menu_window.hide() # switches windows on button click def check_admin_pass(): admin_mainmenu_pass_window.show(wait=True) admin_menu_window.hide() def update_msg(): msg_text.value = '' #windows starts # all the windows are created here and are hidden immediately app = App(title="Biometeric System", width=210, height=210,layout="grid") admin_menu_window = Window(app, title="Admin Menu", width=210, height=210,layout="grid") admin_menu_window.hide() admin_mainmenu_pass_window = Window(app, title="Authenication yourself", width=210, height=210) admin_mainmenu_pass_window.hide() mainmenu_window = Window(app, title="Main Menu", width=210, height=210) mainmenu_window.hide() enroll_window = Window(app, title="Enroll", width=210, height=210) enroll_window.hide() change_pass_password_window = Window(app, title="Provide authenication", width=210, height=210) change_pass_password_window.hide() change_password_window = Window(app, title="Change Password", width=210, height=210)