def add_row(): global add_button global subtract_button global json_file row = 2 + len(json_file["profile"]) x = 8 coords = [] for coord in range(0, 2): entry = TextBox(box2, coord, grid=[x, row]) entry.when_left_button_released = text_click entry.bg = "white" coords.append(entry) x += 1 row += 1 add_button.destroy() subtract_button.destroy() add_button = PushButton(box2, text="+", grid=[8, row], command=add_row) add_button.bg = "white" subtract_button = PushButton(box2, text="-", grid=[9, row], command=subtract_row) subtract_button.bg = "white" json_file["profile"].append(coords)
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 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 game(): global app, questions, answers, correct_answers, qnum, questionText, btn1, btn2, btn3, btn4, nextBtn eh.light.on() questionText = Text(app, questions[qnum]) questionText.text_size = 40 buttons_box = Box(app, width="fill", align="top") btn1 = PushButton(buttons_box, text=answers[qnum][0], align="left") btn1.bg = "blue" btn1.text_color = "white" btn1.text_size = 40 btn2 = PushButton(buttons_box, text=answers[qnum][1], align="left") btn2.bg = (209, 182, 16) btn2.text_color = "white" btn2.text_size = 40 btn3 = PushButton(buttons_box, text=answers[qnum][2], align="left") btn3.bg = "red" btn3.text_color = "white" btn3.text_size = 40 btn4 = PushButton(buttons_box, text=answers[qnum][3], align="left") btn4.bg = "green" btn4.text_color = "white" btn4.text_size = 40 nextBtn = PushButton(app, command=nextQ, text="Next", align="left")
def Run(): global startWindow global finalCheck global startButtons startWindow = Window(app, title="Starting Screen", layout="grid") startWindow.width = 360; startWindow.height = 630; startWindow.bg = "Lime" playersQuestionText = Text(startWindow, text="How Many Players?", grid=[0, 0], align="top") playersQuestionText.text_size = 25 playerButtonContainer = Box(startWindow, layout="grid", grid=[0, 1], align="top", border=True) playerButtonContainer.set_border(10, "Lime") buttonOnePlayer = PushButton(playerButtonContainer, text="1 Player", grid=[1, 0], command=lambda: SetPlayerNumber(True, "1 Player")) buttonOnePlayer.width = 20; buttonOnePlayer.height = 10; buttonOnePlayer.bg = "White" buttonTwoPlayer = PushButton(playerButtonContainer, text="2 Player", grid=[2, 0], command=lambda: SetPlayerNumber(False, "2 Player")) buttonTwoPlayer.width = 20; buttonTwoPlayer.height = 10; buttonTwoPlayer.bg = "White" gameModeQuestionText = Text(startWindow, text="What Game Mode?", grid=[0, 2], align="top") gameModeQuestionText.text_size = 25 gameModeButtonContainer = Box(startWindow, layout="grid", grid=[0, 3], align="top", border=True) gameModeButtonContainer.set_border(10, "Lime") buttonAddition = PushButton(gameModeButtonContainer, text="Addition", grid=[1, 0], command=lambda: SetGameMode(True, "Addition")) buttonAddition.width = 20; buttonAddition.height = 10; buttonAddition.bg = "White" buttonSubtraction = PushButton(gameModeButtonContainer, text="Subtraction", grid=[2, 0], command=lambda: SetGameMode(False, "Subtraction")) buttonSubtraction.width = 20; buttonSubtraction.height = 10; buttonSubtraction.bg = "White" finalCheck = Box(startWindow, layout="grid", grid=[0, 4], align="top", border=True) finalCheck.set_border(10, "Lime") startButton = PushButton(finalCheck, text="Start!", grid=[0, 2], align="top", command=StartGame) startButton.width = 20; startButton.height = 5; startButton.bg = "White"; startButton.disable()
def StartOnePlayer(): global onePlayerWindow global drawButtonOnePlayer global cardImagesOnePlayer global guessContainerOnePlayer global guessCheckButtonOnePlayer global guessTextBoxOnePlayer global correctOnePlayer global errorTextOnePlayer onePlayerWindow = Window(app, title="One Player Game", layout="grid") onePlayerWindow.width = 320; onePlayerWindow.height = 560; onePlayerWindow.bg = "Lime" drawButtonOnePlayer = PushButton(onePlayerWindow, text="Draw!", grid=[0, 0], align="top", command=ButtonSwapOnePlayer) drawButtonOnePlayer.width = 20; drawButtonOnePlayer.height = 5; drawButtonOnePlayer.bg = "White" cardImagesOnePlayer = Box(onePlayerWindow, layout="grid", grid=[0, 1], align="top", border=True) cardImagesOnePlayer.set_border(10, "Lime") guessContainerOnePlayer = Box(onePlayerWindow, layout="grid", grid=[0, 2], align="top", border=True) guessContainerOnePlayer.set_border(10, "Lime") guessTextBoxOnePlayer = TextBox(guessContainerOnePlayer, grid=[0, 0], align="top") guessTextBoxOnePlayer.text_size = 20; guessTextBoxOnePlayer.bg = "White"; guessTextBoxOnePlayer.disable(); guessCheckButtonOnePlayer = PushButton(guessContainerOnePlayer, text="Check!", grid=[0, 1], align="top", command=CheckValuesOnePlayer) guessCheckButtonOnePlayer.width = 20; guessCheckButtonOnePlayer.height = 5; guessCheckButtonOnePlayer.bg = "White"; guessCheckButtonOnePlayer.disable(); pointsTextOnePlayer = Text(guessContainerOnePlayer, text="Score: ", grid=[0, 2], align="top") correctOnePlayer = Text(onePlayerWindow, text="", grid=[0, 3]) errorTextOnePlayer = Text(onePlayerWindow, text="Please enter a number!", grid=[0, 4]) errorTextOnePlayer.hide()
def init_widgets(): global app, Weather_drawing, Add_textbox, To_do_list_Title, Addbutton, delbutton, Clearbutton, Citybutton To_do_list_Title = Text(app, "To-do List:", size=20, color="light gray", grid=[0,2,1,1],align="left") create_list() Add_textbox=TextBox(app,grid=[0,4,1,1],width=50, align="left") Add_textbox.text_size=12 Add_textbox.text_color="Black" Add_textbox.font="Century Gothic Bold" Add_textbox.bg="white" Addbutton = PushButton(app, command=addto_todolist, image="Images/add_button.png", grid=[0,4,1,1],align="right") delbutton = PushButton(app, command=delfrom_todolist, image="Images/sub_button.png", grid=[1,4,4,1],align="right") Clearbutton = PushButton(app, command=clear_todolist, image="Images/clear_button.png", grid=[0,5], width=100, height=50, align="left") Clearbutton.bg = "light gray" Citybutton = PushButton(app, command=change_city, image="Images/Change_city_button.png", grid=[0,5], width=160, height=50) Citybutton.bg = "light gray" Weather_drawing = Drawing(app,grid=[0,6,2,1],align="left",width=600,height=300) weather_font_color = which_color(description) Image_picture = which_image(description) update_weather() Weather_drawing.image(0,0,image="Images/" + Image_picture, width=600,height=400) city_num_x = 200 - (len(city_name)*10) city_num_y = 0 Weather_drawing.text(city_num_x,city_num_y, text= city_name, color=weather_font_color,font="Arial",size=40) Weather_drawing.text(135 - len(temp),45, text= temp, color=weather_font_color,font="Arial",size=50) Weather_drawing.text(110 - len(temp),110, text= "Low:" + temp_min, color=weather_font_color,font="Arial",size=15) Weather_drawing.text(225 - len(temp) + len(temp_high)*2,110, text= "High:" + temp_high, color=weather_font_color,font="Arial",size=15) Weather_drawing.text(150 - len(humidity),135, text= "Humidity: " + humidity, color=weather_font_color,font="Arial",size=15) Weather_drawing.text(125 - len(wind_speed),155, text= "Wind Speed: " + wind_speed, color=weather_font_color,font="Arial",size=15) Add_textbox.when_clicked = Make_keys
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 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 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 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"
def get_hip(): window = Window(app, title="R&B", height="320", width="480", bg="light slate blue") window.tk.attributes("-fullscreen", True) def play_hiphop(): get_files(directories[6], window) def play_classicrb(): get_files(directories[7], window) def close_get_hip(): window.hide() welcome_message = Text(window, text="R&B", size=30, font="Arial", color="white", align="top") hiphop_button = PushButton(window, command=play_hiphop, text="Hip Hop", align="left") hiphop_button.text_color = "purple4" hiphop_button.text_size = "12" hiphop_button.font = "Arial" hiphop_button.bg = "white" classicrb_button = PushButton(window, command=play_classicrb, text="Classic R & B", align="right") classicrb_button.text_color = "purple4" classicrb_button.text_size = "12" classicrb_button.font = "Arial" classicrb_button.bg = "white" close_get_hip = PushButton(window, text="go back", command=close_get_hip, align="bottom") close_get_hip.text_color = "purple4" close_get_hip.text_size = "12" close_get_hip.font = "Arial" close_get_hip.bg = "white"
def manualDrill(): second_message.value = "Entering Manual Mode" STARS_aPP.drillType = "manual" window3 = Window(app, bg="darkgreen") welcome_message3 = Text(window3, "Manual Mode Controls", size=25, font="Times New Roman", color="black") third_message3 = Text(window3, "Please select a ball speed:", size=15, font="Times New Roman", color="black") speed = Slider(window3, command=STARS_aPP.ball_speed_slider, start=1, end=5) speed.width = 300 start_3 = PushButton(window3, command=STARS_aPP.start_command, args = [STARS_aPP.ballSpeed , STARS_aPP.difficulty, STARS_aPP.drillType], text="Begin") stop_3 = PushButton(window3, command=STARS_aPP.stop_command, text="stop") start_3.width = 30 start_3.bg = "gray" stop_3.width = 30 stop_3.bg = "gray"
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 draw_init(day_window, on_off_hour_list): i = 1 count2 = 0 hours = range(0, 24) for count in hours: if count < 10: button_text = "0" + str(count) button_text2 = "0" + str(count + 1) else: button_text = str(count) button_text2 = str(count + 1) text = Text(day_window, text=button_text + ":00", size=5, grid=[count2, i], align="right") button = PushButton(day_window, text="OFF", grid=[count2 + 1, i], align="left") button.when_clicked = partial(set_hour_on_off, count, button) if on_off_hour_list[count] == "OFF": button.bg = "blue" button.text = "OFF" else: button.bg = "red" button.text = "ON" button.text_size = 5 text = Text(day_window, text=button_text2 + ":00", size=5, grid=[count2 + 2, i], align="left") count2 = count2 + 3 if count2 % 9 == 0: if i != 0: i = i + 1 count2 = 0
def question3(): global sb, txt, qth qth = Window(app, title="Question Three", width=800, height=400) qth.show() print("start question 3") txt = Text(qth, text="Hold the screen out in front of you") txt.text_size = 40 txt.text_color = 'magenta' sb = PushButton(qth, text="Begin", padx=240, pady=80, command=balancetest) sb.bg = 'green' sb.text_size = 100
def change_city(): global app global window global Display_list, Weather_drawing, Add_textbox, To_do_list_Title, Addbutton, delbutton, Clearbutton, Citybutton, Spotifybutton def Confirm_city(): global city_name if (City_name_entry_textbox.value): city_name = City_name_entry_textbox.value f = open("Weather_loc.txt", "w") f.write(city_name) f.close() Confirmbutton.destroy() City_name_entry_textbox.destroy() City_name_ask_title.destroy() Destroy_keys() init_widgets() if (keys_exist == 1): Destroy_keys() To_do_list_Title.destroy() Add_textbox.destroy() Addbutton.destroy() delbutton.destroy() Citybutton.destroy() Spotifybutton.destroy() Display_list.destroy() Clearbutton.destroy() Weather_drawing.destroy() City_name_ask_title = Text(app, "Type the name of a city:", size=35, font="Century Gothic Bold", color="light gray", grid=[0, 2, 2, 1], align="left") City_name_entry_textbox = TextBox(app, grid=[0, 3], width=50) City_name_entry_textbox.text_size = 12 City_name_entry_textbox.text_color = "Black" City_name_entry_textbox.font = "Century Gothic Bold" City_name_entry_textbox.bg = "white" City_name_entry_textbox.when_clicked = Make_keys Confirmbutton = PushButton(app, command=Confirm_city, image="Images/Confirm.png", grid=[0, 4], width=120, height=50) Confirmbutton.bg = "light gray" app.focus()
def staticDrill(): second_message.value = "Static Passing Selected" STARS_aPP.drillType = "static" window1 = Window(app, bg="darkgreen") welcome_message2 = Text(window1, "Static Passing Parameters", size=25, font="Times New Roman", color="black") third_message1 = Text(window1, "Please select a passing speed:", size=15, font="Times New Roman", color="black") speed = Slider(window1, command=STARS_aPP.ball_speed_slider, start=1, end=5) speed.width = 300 final_message1 = Text(window1, "Please select a difficulty:", size=15, font="Times New Roman", color="black") difficulty = Slider(window1, command=STARS_aPP.difficulty_slider, start=1, end=5) difficulty.width = 300 start_1 = PushButton(window1, command=STARS_aPP.start_command, args = [STARS_aPP.ballSpeed , STARS_aPP.difficulty, STARS_aPP.drillType], text="Begin") stop_1 = PushButton(window1, command=STARS_aPP.stop_command, text="stop") start_1.width = 30 start_1.bg = "gray" stop_1.width = 30 stop_1.bg = "gray"
def predictiveDrill(): second_message.value = "Entering Predictive Passing Mode" STARS_aPP.drillType = "dynamic" window2 = Window(app, bg="darkgreen") welcome_message2 = Text(window2, "Predictive Passing Controls", size=25, font="Times New Roman", color="black") third_message2 = Text(window2, "Please select a ball speed:", size=15, font="Times New Roman", color="black") speed = Slider(window2, command=STARS_aPP.ball_speed_slider, start=1, end=5) speed.width = 300 final_message1 = Text(window2, "Please select a difficulty:", size=15, font="Times New Roman", color="black") difficulty = Slider(window2, command=STARS_aPP.difficulty_slider, start=1, end=5) difficulty.width = 300 args = 1 start_2 = PushButton(window2, command=STARS_aPP.start_command, args = [STARS_aPP.ballSpeed , STARS_aPP.difficulty, STARS_aPP.drillType], text="Begin") stop_2 = PushButton(window2, command=STARS_aPP.stop_command, text="stop") start_2.width = 30 start_2.bg = "gray" stop_2.width = 30 stop_2.bg = "gray"
def showBoard(): global board, tileButtonDict, tileList, gameBoard, difficulty createGame(difficulty) rowLabelCount = 0 columnLabelCount = 0 if len(tileList) > 256: rowLength = int(len(tileList)/16) else: rowLength = math.sqrt(len(tileList)) rowCount = 0 columnCount = 0 for tile in tileList: if not tile.isMined: surroundingMines = Text(board, text=str(tile.surroundingMineCount), grid=[columnCount,rowCount]) surroundingMines.height = 2 surroundingMines.width = 3 textDict[tile.label] = surroundingMines else: picture = Picture(board, image='bomb2.jpg', grid=[columnCount,rowCount]) picture.height = 25 picture.width = 15 mineDict[tile.label] = picture tileButton = PushButton(board, command=playGame, image = 'blank.jpg' , args=[tile], grid=[columnCount,rowCount], text='')#str(tile)#.isMined))#str(tile)) tileButton.bg = 'gray60' #print ('button grid', tileButton.grid) tileButton.when_right_button_pressed = markTile tileButton.width = 32 tileButton.height = 37 tileButtonDict[tile.label] = tileButton columnCount += 1 if columnCount == rowLength: rowCount += 1 columnCount = 0
def subtract_row(): global add_button global subtract_button global json_file row = len(json_file["profile"]) - 1 x = 8 coords = [] for coord in json_file["profile"][row]: coord.destroy() x += 1 json_file["profile"].pop() row = len(json_file["profile"]) + 2 add_button.destroy() subtract_button.destroy() add_button = PushButton(box2, text="+", grid=[8, row], command=add_row) add_button.bg = "white" subtract_button = PushButton(box2, text="-", grid=[9, row], command=subtract_row) subtract_button.bg = "white"
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 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 setup_board(): pictures = [] buttons = [] for x in range(0, 3): for y in range(0, 3): picture = Picture(picture_grid, image=get_random_sprite(), grid=[x, y]) picture.bg = "royal blue" picture.tk.config(height=100) picture.tk.config(width=100) pictures.append(picture) button_number = 0 for x in range(0, 3): for y in range(0, 3): button = PushButton(button_grid, command=match, args=[False], grid=[x, y]) button.width = 100 button.height = 100 button.icon(get_random_sprite()) button.bg = "dodger blue" button_number += 1 buttons.append(button) chosen_one = get_random_sprite() winning_button = randint(0, 8) buttons[winning_button].icon(chosen_one) buttons[winning_button].update_command(match, args=[True]) pictures[randint(0, 8)].value = chosen_one app.display()
space2 = Text(window, text=" xxx", size=5) space2.text_color = "white" text_pengisian = Text(window, text="Jumlah Total Pengisian Solar (liter)", size=30, grid=(1, 0, 1, 1)) pengisianVal = Text(window, text="0", size=140) pengisianVal.repeat(100, set_totalizer) pulse_value = Text(window, text=pulse_signal.value, size=14) pulse_value.text_color = "black" pulse_value.repeat(100, pulseVal) cumulative_counting = Text(window, text="0", size=14) cumulative_counting.text_color = "black" cumulative_counting.repeat(10, normalCounting) button_send = PushButton(window, text="Send Data", command=monitoring) button_send.bg = "blue" button_send.text_color = "white" button_send.width = 12 button_send.height = 2 button_monitoring = PushButton(window, text="<<", command=monitoring, align="bottom") #button_monitoring.bg="green" #button_monitoring.text_color="white" button_monitoring.width = 5 button_monitoring.height = 2 window.hide() #button_reset = PushButton(app, text="Reset") #button_reset.bg="white"
def do_nothing9(): process = subprocess.Popen( "sudo gnome-terminal -x /home/administrator/BiosUnlocking/gui/exe55.sh", stdout=subprocess.PIPE, stderr=None, shell=True) app = App(title="Dell E6440 Computrace Removal") button1 = PushButton(app, command=do_nothing1, text="Scan Chip") button2 = PushButton(app, command=do_nothing2, text="W25Q32 Wipe 4MB") button3 = PushButton(app, command=do_nothing3, text="W25Q32 Write 4MB") button4 = PushButton(app, command=do_nothing4, text="W25Q64BV Wipe 8MB") button5 = PushButton(app, command=do_nothing5, text="W25Q64BV Write 8MB") button6 = PushButton(app, command=do_nothing2, text="EN25QH32 Wipe 4MB") button7 = PushButton(app, command=do_nothing3, text="EN25QH32 Write 4MB") button8 = PushButton(app, command=do_nothing4, text="EN25QH64 Wipe 8MB") button9 = PushButton(app, command=do_nothing5, text="EN25QH64 Write 8MB") button1.bg = "white" button2.bg = "red" button3.bg = "green" button4.bg = "red" button5.bg = "green" button6.bg = "red" button7.bg = "green" button8.bg = "red" button9.bg = "green" app.display()
) startBtnSpacer = Text( startScr, text=" ", size=50, ) startBtn = PushButton( startScr, text="Start Game", command=gotoScreen0, padx=0, pady=0, ) startBtn.bg = "#e0e0e0" #light grey startBtn.width = 25 startBtn.height = 1 startBtn.text_size = 15 endBtnSpacer = Text(startScr, text=" ", size=25, align="bottom") endBtn = PushButton( startScr, text="Quit", command=windowClose, align="bottom", padx=0, pady=0, ) endBtn.width = 10
def Make_keys(): global Keyboard_box global keys_exist global uppercase global lower_letters if (keys_exist == 0): Weather_drawing.grid = [0, 7, 2, 1] Keyboard_box = Box(app, width=500, height=300, layout="grid", grid=[0, 6, 4, 1]) keys_exist = 1 uppercase = 0 elif (keys_exist == 1 and uppercase == 1): Keyboard_box.destroy() Keyboard_box = Box(app, width=500, height=300, layout="grid", grid=[0, 6, 2, 1]) uppercase = 0 #Keyboard #1st Row Q_button = PushButton(Keyboard_box, grid=[0, 0], width=2, height=2, text=lower_letters[0], command=type_function, args=lower_letters[0]) Q_button.bg = "light gray" Q_button.text_size = 10 W_button = PushButton(Keyboard_box, grid=[1, 0], width=2, height=2, text=lower_letters[1], command=type_function, args=lower_letters[1]) W_button.bg = "light gray" W_button.text_size = 10 E_button = PushButton(Keyboard_box, grid=[2, 0], width=2, height=2, text=lower_letters[2], command=type_function, args=lower_letters[2]) E_button.bg = "light gray" E_button.text_size = 10 R_button = PushButton(Keyboard_box, grid=[3, 0], width=2, height=2, text=lower_letters[3], command=type_function, args=lower_letters[3]) R_button.bg = "light gray" R_button.text_size = 10 T_button = PushButton(Keyboard_box, grid=[4, 0], width=2, height=2, text=lower_letters[4], command=type_function, args=lower_letters[4]) T_button.bg = "light gray" T_button.text_size = 10 Y_button = PushButton(Keyboard_box, grid=[5, 0], width=2, height=2, text=lower_letters[5], command=type_function, args=lower_letters[5]) Y_button.bg = "light gray" Y_button.text_size = 10 U_button = PushButton(Keyboard_box, grid=[6, 0], width=2, height=2, text=lower_letters[6], command=type_function, args=lower_letters[6]) U_button.bg = "light gray" U_button.text_size = 10 I_button = PushButton(Keyboard_box, grid=[7, 0], width=2, height=2, text=lower_letters[7], command=type_function, args=lower_letters[7]) I_button.bg = "light gray" I_button.text_size = 10 O_button = PushButton(Keyboard_box, grid=[8, 0], width=2, height=2, text=lower_letters[8], command=type_function, args=lower_letters[8]) O_button.bg = "light gray" O_button.text_size = 10 P_button = PushButton(Keyboard_box, grid=[9, 0], width=2, height=2, text=lower_letters[9], command=type_function, args=lower_letters[9]) P_button.bg = "light gray" P_button.text_size = 10 #2nd Row A_button = PushButton(Keyboard_box, grid=[0, 1, 2, 1], width=2, height=2, text=lower_letters[10], command=type_function, args=lower_letters[10]) A_button.bg = "light gray" A_button.text_size = 10 S_button = PushButton(Keyboard_box, grid=[1, 1, 2, 1], width=2, height=2, text=lower_letters[11], command=type_function, args=lower_letters[11]) S_button.bg = "light gray" S_button.text_size = 10 D_button = PushButton(Keyboard_box, grid=[2, 1, 2, 1], width=2, height=2, text=lower_letters[12], command=type_function, args=lower_letters[12]) D_button.bg = "light gray" D_button.text_size = 10 F_button = PushButton(Keyboard_box, grid=[3, 1, 2, 1], width=2, height=2, text=lower_letters[13], command=type_function, args=lower_letters[13]) F_button.bg = "light gray" F_button.text_size = 10 G_button = PushButton(Keyboard_box, grid=[4, 1, 2, 1], width=2, height=2, text=lower_letters[14], command=type_function, args=lower_letters[14]) G_button.bg = "light gray" G_button.text_size = 10 H_button = PushButton(Keyboard_box, grid=[5, 1, 2, 1], width=2, height=2, text=lower_letters[15], command=type_function, args=lower_letters[15]) H_button.bg = "light gray" H_button.text_size = 10 J_button = PushButton(Keyboard_box, grid=[6, 1, 2, 1], width=2, height=2, text=lower_letters[16], command=type_function, args=lower_letters[16]) J_button.bg = "light gray" J_button.text_size = 10 K_button = PushButton(Keyboard_box, grid=[7, 1, 2, 1], width=2, height=2, text=lower_letters[17], command=type_function, args=lower_letters[17]) K_button.bg = "light gray" K_button.text_size = 10 L_button = PushButton(Keyboard_box, grid=[8, 1, 2, 1], width=2, height=2, text=lower_letters[18], command=type_function, args=lower_letters[18]) L_button.bg = "light gray" L_button.text_size = 10 #3rd Row shift_button = PushButton(Keyboard_box, grid=[0, 2, 2, 1], align="left", width=2, height=2, padx=15, pady=10, text="Shift", command=Make_upperkeys) shift_button.bg = "light gray" shift_button.text_size = 10 Z_button = PushButton(Keyboard_box, grid=[1, 2, 2, 1], width=2, height=2, text=lower_letters[19], command=type_function, args=lower_letters[19]) Z_button.bg = "light gray" Z_button.text_size = 10 X_button = PushButton(Keyboard_box, grid=[2, 2, 2, 1], width=2, height=2, text=lower_letters[20], command=type_function, args=lower_letters[20]) X_button.bg = "light gray" X_button.text_size = 10 C_button = PushButton(Keyboard_box, grid=[3, 2, 2, 1], width=2, height=2, text=lower_letters[21], command=type_function, args=lower_letters[21]) C_button.bg = "light gray" C_button.text_size = 10 V_button = PushButton(Keyboard_box, grid=[4, 2, 2, 1], width=2, height=2, text=lower_letters[22], command=type_function, args=lower_letters[22]) V_button.bg = "light gray" V_button.text_size = 10 B_button = PushButton(Keyboard_box, grid=[5, 2, 2, 1], width=2, height=2, text=lower_letters[23], command=type_function, args=lower_letters[23]) B_button.bg = "light gray" B_button.text_size = 10 N_button = PushButton(Keyboard_box, grid=[6, 2, 2, 1], width=2, height=2, text=lower_letters[24], command=type_function, args=lower_letters[24]) N_button.bg = "light gray" N_button.text_size = 10 M_button = PushButton(Keyboard_box, grid=[7, 2, 2, 1], width=2, height=2, text=lower_letters[25], command=type_function, args=lower_letters[25]) M_button.bg = "light gray" M_button.text_size = 10 backspace_button = PushButton(Keyboard_box, grid=[8, 2, 2, 1], align="right", width=2, height=2, padx=15, pady=10, text="<-", command=type_function, args=lower_letters[27]) backspace_button.bg = "light gray" backspace_button.text_size = 10 #4th Row Space_button = PushButton(Keyboard_box, grid=[2, 3, 6, 1], width=28, height=2, padx=5, pady=1, text="Space", command=type_function, args=lower_letters[26]) Space_button.bg = "light gray" Space_button.text_size = 10 Hide_button = PushButton(Keyboard_box, grid=[8, 3, 6, 1], width=5, height=2, padx=5, pady=1, text="Hide", command=Destroy_keys) Hide_button.text_size = 10 Hide_button.bg = "light gray"
#main window starts # user can login or logout on this window # admin menu can be accessed from here main_window_time = Text(app, text=strftime("%H:%M:%S", gmtime()), grid=[0,0]) main_window_time.repeat(100, update_time) # Schedule call to update time main_window_date = Text (app, text=strftime("%d,%b,%Y", gmtime()), grid=[0,1]) main_window_date.repeat(10800000, update_date) #repeat every 3hrs module_test = Text(app, text="checking modules...", grid=[0,2]) admin_menu_btn = PushButton(app, text="ADMIN MENU" ,command=admin_warn, grid=[0,4]) admin_menu_btn.bg = "blue" msg_text = Text(app, text="####", grid=[0,5]) #msg_text.repeat(5000, update_msg) attendance_text = Text(app, text="####", grid=[0,6]) picture1 = Picture(app, image="28.jpg", grid=[1,0,3,6]) module_init() #initialize module #main window ends #admin menu window starts admin_main_menu_btn = PushButton(admin_menu_window, text="Main Menu" ,command=check_admin_pass, grid=[0,0]) admin_main_menu_btn.bg = "blue" back_btn = PushButton(admin_menu_window, text="Back" ,command=admin_back, grid=[1,0]) back_btn.bg = "blue"
app = App(title='interfaccia-grafico') grafico_text = Text(app, text='Grafico', font = 'arial', size=40) whatever = TextBox(app, width=50, multiline=True, height=2) whatever.value='Interfaccia grafico' output = TextBox(app, width=80, height=10, multiline=True) push1 =PushButton(app, text='definire le coordinate', command=tasto0) push2 =PushButton(app, text='coordinate', command=tasto1) push3 = PushButton(app, text='grafico', command=tasto2) app.bg="#000000" grafico_text.text_color ="#FFFFFF" whatever.bg="#FFFFFF" push1.bg="#E52B50" push2.bg="#CC9966" push3.bg="#5E86C1" output.bg="#008f39" app.display()
f.close() create_list() print(Todolist) #Clear List button ######################################################################################################### global Clearbutton Clearbutton = PushButton(app, command=clear_todolist, image="Images/clear_button.png", grid=[0, 5], width=100, height=50, align="left") Clearbutton.bg = "light gray" #Temperature and Weather ############################################################################################################################################ def init_widgets(): global app, Weather_drawing, Add_textbox, To_do_list_Title, Addbutton, delbutton, Clearbutton, Citybutton, Spotifybutton To_do_list_Title = Text(app, "To-do List:", size=20, color="light gray", grid=[0, 2, 1, 1], align="left") create_list() Add_textbox = TextBox(app, grid=[0, 4, 1, 1], width=50, align="left")