def new_game(): global game_timer global rounds global correct_guesses global leaderboard # destroys and creates leaderboard window leaderboard.destroy() leaderboard = Window(app, title="High Scores") leaderboard.hide() # resets variable values timer.value = game_timer result.value = "" score.value = "0" correct_guesses = 0 game_timer = 20 score_bonus.value = "" # adds to round count rounds += 1 # displays player's turn info("Player Turn", current_player + "'s turn.") # restarts game setup_round() # starts new timer timer.repeat(1000, counter)
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()
return def open_window(): window.show() def close_window(): window.hide() app = App(title="مترو") #app = App(layout="grid") window = Window(app, title="Map") window.hide() maintext = Text(app, text="نوع التذكره" ,size=60 ,font="Times new roman" ,color="red") open_button = PushButton(app, command=open_window ,pady=80, padx=150 , text="Show Map") x_3= PushButton(app,command=select_3 ,pady=50, padx=120,text=" 3 جنيه",align="left") x_5 = PushButton(app,command=select_5 ,pady=50,padx=120,text=" 5 جنيه",align="left") x_7 = PushButton(app,command=select_7 ,pady=50,padx=120,text=" 7 جنيه",align="left") x_10= PushButton(app,command=select_10 ,pady=50, padx=120,text="10 جنيه",align="left")
def chmenu(): process = subprocess.Popen("ch/chmenu.sh") def lsmenu(): process = subprocess.Popen("ls/lsmenu.sh") def close_window(): app.destroy() app = App(title="Programmer Selection") window1 = Window(app, title="Dediprog") window1.hide() window2 = Window(app, title="CH341A_SPI") window2.hide() window3 = Window(app, title="LinuxSPI(rpi etc)") window3.hide() open_button = PushButton(app, command=dpmenu, text="Dediprog") close_button = PushButton(window1, text="Close", command=close_window1) open_button = PushButton(app, command=chmenu, text="CH341A_SPI") close_button = PushButton(window2, text="Close", command=close_window2) open_button = PushButton(app, command=lsmenu, text="LinuxSPI(rpi etc)") close_button = PushButton(window3, text="Close", command=close_window3) button1 = PushButton(app, command=close_window, text="Close") app.display()
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",
food_list = [] course_list = [] ordered_list = [] # add courses Course("Starter") Course("Main") Course("Dessert") # create the application interface from guizero import App, Text, ListBox, PushButton, TextBox, Box, Combo, error, yesno, Window, question app = App(title="Tom's Garage", layout="grid") admin_tab = Window(app, title="Admin Menu", layout="grid") admin_tab.hide() # box for the course buttons to sit inside cbox = Box(app, grid=[0, 0]) # box for the displayed food to sit inside # also the admin button for a user to gain admin privilages fbox = Box(app, grid=[1, 0]) # box for the orders that the waiter has selected to display in, also the buttons to clear and order obox = Box(app, grid=[2, 0]) # Admin row 1 aabox = Box(admin_tab, grid=[1, 0]) abbox = Box(admin_tab, grid=[2, 0]) acbox = Box(admin_tab, grid=[3, 0]) agbox = Box(admin_tab, grid=[4, 0])
space = PushButton(app, grid=[2,0], width=10, height=10, image="/home/pi/TouchCam/icon/100black.png", command=fullscreen) button2 = PushButton(app, grid=[3,1], width=150, height=150, image="/home/pi/TouchCam/icon/cam.png", command=capture_image) text2 = Text(app, color="white", grid=[3,2],text="Image") space2 = PushButton(app, grid=[4,0], width=10, height=10, image="/home/pi/TouchCam/icon/100black.png", command=long_preview) button3 = PushButton(app, grid=[5,1], width=150, height=150, image="/home/pi/TouchCam/icon/vid.png", command=video_capture) text2 = Text(app, color="white", grid=[5,2],text="HD 30s") space3 = PushButton(app, grid=[6,0], width=10, height=10, image="/home/pi/TouchCam/icon/100black.png", command=long_preview) button4 = PushButton(app, grid=[7,1], width=150, height=150, image="/home/pi/TouchCam/icon/lapse.png", command=burst) text3 = Text(app, color="white", grid=[7,2],text="Burst") space4 = PushButton(app, grid=[8,0], width=10, height=10, image="/home/pi/TouchCam/icon/100black.png", command=long_preview) button5 = PushButton(app, grid=[1,3], width=150, height=150, image="/home/pi/TouchCam/icon/self.png", command=lapse) text4 = Text(app, color="white", grid=[1,4],text="1h 60pix") button6 = PushButton(app, grid=[3,3], width=150, height=150, image="/home/pi/TouchCam/icon/long.png", command=split_hd_30m) text2 = Text(app, color="white", grid=[3,4],text="HD 30m in 5s") button7 = PushButton(app, grid=[5,3], width=150, height=150, image="/home/pi/TouchCam/icon/drop.png", command=upload) text3 = Text(app, color="white", grid=[5,4],text="Upload") button8 = PushButton(app, grid=[7,3], width=150, height=150, image="/home/pi/TouchCam/icon/del.png", command=clear) text4 = Text(app, color="white", grid=[7,4],text="Clear Folder") busy = Window(app, bg="red", height=100, width=800, title="busy") # app.tk.attributes("-fullscreen", True) busy.hide() app.display()
control_app.tk.attributes('-fullscreen', True) # FULLSCREEN control_app.font = 'Inter UI Bold' control_app.text_size = 10 control_app.height = 480 control_app.width = 800 control_app.tk.config(cursor='none') control_app.repeat(1000, thermalCountUp) # Feedback Window FeedbackWindow = Window(control_app) FeedbackWindow.text_size = 18 FeedbackWindow.font = 'Nexa Bold' FeedbackWindow.tk.attributes('-fullscreen',True) FeedbackWindow.height = 480 FeedbackWindow.width = 800 FeedbackWindow.hide() FeedbackWindow.bg = 'black' FeedbackWindow.tk.config(cursor='none') # buttons on feedback window gap = Text(FeedbackWindow,'') happy = Picture(FeedbackWindow, 'happy.gif') happy.when_clicked = goodFeedback gap = Text(FeedbackWindow,'') #happyText = Text(FeedbackWindow, text = 'I learned something\n new today!', grid = [1,0], color = 'white', align = 'left') confused = Picture(FeedbackWindow,'confused.gif') confused.when_clicked = badFeedback #confText = Text(FeedbackWindow, text = "I'm still not sure...", grid = [1,1], color = 'white', align = 'left') #smiley1 = PushButton(FeedbackWindow, text=':)', command=smiley1_callback) #smiley2 = PushButton(FeedbackWindow, text=':(', command=smiley2_callback)
stop_label.value = "Stopped" stop_label.text_color = "Red" def reset(): stop_label.value = "Running" stop_label.text_color = "Green" def open_debug_window(): debug.show() app = App(title="BreweryGUI", layout="grid", width=1280, height=720) debug = Window(app, title="Debug Window", layout="grid", width=600) debug.hide() ######################################################################################################################## #defining all labels and text stop_label = Text(app, grid=[0, 0], text="", size=15, color="Green") reset_button = PushButton(app, grid=[1, 0], text="Reset", command=reset, align="left") error_text = Text(app, grid=[0, 3], text="", size=15, color="Red") debug_window = PushButton(app, grid=[4, 0], text="Open Debug Commands", command=open_debug_window)
random_button = randint(0, 8) buttons[random_button].image = matched_emoji # sets the correct button to report true (the matched cell) buttons[random_button].update_command(match_emoji, [True]) # Displays rounds played rounds_played.value = "Rounds played: " + str(rounds) app = App("emoji match", width=420, height=574) # leader board window setup leaderboard = Window(app, title="High Scores") leaderboard.hide() # sets up widgets for player name entry and displays rules player_name_window = Window(app, title="Enter player names") Text(player_name_window, "\n") player_box = Box(player_name_window) player_one_label = Text(player_box, text="Player one: ", align="left") player_one_name = TextBox(player_box, align="left") player_two_label = Text(player_box, text=" Player two: ", align="left") player_two_name = TextBox(player_box, align="left") Text(player_name_window, "\n") PushButton(player_name_window, text="Start Game", command=set_names) Text(player_name_window, "\n\nEmoji Matching Game Rules", size=18) Text(player_name_window, "- There is exactly one emoji that is in both top and bottom grids") Text(player_name_window,
selected='1 mm', command=confirmer_espacement, grid=[1, 4], align='left') bouton_confirmer_premiere_page = PushButton(premiere, text="Confirmer les informations", command=confirmation_premiere_page, grid=[0, 5]) deuxieme = Window(premiere, layout="grid", title="Lancement de l'impression", width=900, height=500) deuxieme.hide() bouton_manuel_on = PushButton(premiere, text="mode manuel", command=activer_mode_manuel, grid=[1, 5]) bouton_manuel_off = PushButton(premiere, text="arret manuel", command=arreter_mode_manuel, grid=[1, 6]) ############################# ### boutons deuxieme page ### ############################# texte_mode = Text(deuxieme, "Mode d'impression : ", size=15, grid=[0, 0])
#buttons to adjust number of teeth btnMinus10 = PushButton(app, command=minus10teeth, text="-10", grid=[2, 1]) btnMinus1 = PushButton(app, command=minus1tooth, text="-1", grid=[3, 1]) btnPlus1 = PushButton(app, command=plus1tooth, text="+1", grid=[4, 1]) btnPlus10 = PushButton(app, command=plus10teeth, text="+10", grid=[5, 1]) #button to start cutting btnGo = PushButton(app, command=calculateSteps, text="Go", grid=[3, 2]) #cutting window cuttingWindow = Window(app, title="Dividing", width=200, height=100, layout="grid") cuttingWindow.hide() cuttingWindow.on_close(closeCutting) app.focus() lblCurrentTooth = Text(cuttingWindow, size=16, text="1", grid=[0, 0]) lblOf = Text(cuttingWindow, size=16, text="of", grid=[1, 0]) lblTotalTeeth = Text(cuttingWindow, size=16, text="", grid=[2, 0]) lblTotalTeeth.value = teethToCut #btnBack = PushButton(cuttingWindow, text="Back", grid=[0,1]) btnNext = PushButton(cuttingWindow, command=nextTooth, text="Next", grid=[1, 1]) #btnFinish = PushButton(cuttingWindow, text="Finish", grid=[2,1]) app.display()
# 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) change_password_window.hide()
print("[INFO] Sending message...") print("[INFO] Message sent.") data = s.recv(4096) print("[INFO] Data received") print (data) if data == b'R': plano.hide() caja.value="******" if data == b'3' and plano.visible == True: s.sendall(data) ###DECLARA GUI app = App(title="Main", layout="grid", height = 1050 , width = 1680) plano = Window(app,title="Answer") plano.hide() croquis=Picture(plano, image = "plano.gif",grid=[0,0,]) app.tk.attributes("-fullscreen",True) plano.tk.attributes("-fullscreen",True) fondo=Picture(app, image = "fondo.png",grid=[0,0,]) fondo.tk.place(height=1050,width=1680) caja = TextBox(app, grid = [3,4], width = 20, text = "******") caja.tk.place(x=765,y=600) boton_login = PushButton(app,grid=[3,5],text="LOGIN", command = push_login) source_boton = Image.open("b_login.png") boton_login.image=source_boton boton_login.tk.place(x=720,y=650) data = None timeout = 3 # timeout in seconds msg = "test"
class ProgCalc: def __init__(self, input_excel_db): self.min_size = 32 self.no_bits = 8 self.value = 0 self.bit_map = {} self.bit_descr = {} self.endianess = "big" self.app = App(layout="grid", height=350, width=550) self.top_box = Box(self.app, layout = "grid", grid = [0, 0]) self.bottom_box = Box(self.app, layout = "grid", grid = [0, 1]) self.right_box = Box(self.app, grid = [1, 0, 1, 2]) self.window = Window(self.app, width=250, height=150, visible=False) self.description = Text(self.window) # Create the text field to enter data self.input = TextBox(self.top_box, width=25, grid=[0,0,3,1], command=self.process_input) self.input.bg = "white" self.input.text_size = 16 # Display the hex value self.out_hex = Text(self.top_box, grid=[2,1], text="0x<waiting for valid input>") # Display the min number of bits selector self.in_minsize = Combo(self.top_box, grid=[0, 1], options=["32"], command=self.process_minsize, selected="32") # Endianess selector self.in_endianess = Combo(self.top_box, grid=[1, 1], options=["little", "big"], command=self.process_endianess, selected=self.endianess) # Display the binary value self.out_bin = Text(self.top_box, grid=[0, 2, 2, 1], size=17, text="0b<waiting for valid input>") # Display little number after the binary value self.out_num = Text(self.top_box, grid=[0, 3, 2, 1], size=7, text="") # Prepare the waffle list self.waffle_list = [] self.box_list = [] self.text_list = [] self.append_wb(4) self.append_tx(self.no_bits) # Read the worksheets in the input dictionary and create the list self.in_excel = openpyxl.load_workbook(filename = input_excel_db, read_only=True) self.in_regs = self.in_excel.sheetnames self.in_regs.insert(0, "OFF") # Display the list of registers self.in_reglist = ListBox(self.right_box, items = self.in_regs, command=self.process_reglist) self.input.focus() self.app.display() def append_wb(self, number): last_waffle = len(self.waffle_list) for i in range(0, 2* number, 2): w = Waffle(self.bottom_box, height=self.no_bits, width=1, grid=[last_waffle + i, 0]) w.hide() w.when_clicked = self.process_waffle self.waffle_list.append(w) b = Box(self.bottom_box, grid=[i + 1, 0]) b.hide() self.box_list.append(b) def append_tx(self, number): for i in range(0, len(self.box_list)): try: tmp = self.text_list[i] except: tmp = [] for j in range(0, self.no_bits): tx = Text(self.box_list[i]) tx.hide() tx.size = 14 # perfect size for all variants tx.when_mouse_enters = self.show_description tx.when_mouse_leaves = self.hide_description tmp.append(tx) self.text_list.append(tmp) def show_description(self, event_data): name = event_data.widget.value for elem in self.bit_map: if self.bit_map[elem] == name: self.description.value = self.bit_descr[elem] break self.window.show() def hide_description(self, event_data): self.window.hide() def process_input(self, inp): try: self.value = int(self.input.value, 0) self.refresh_all() except ValueError: return def process_endianess(self, inp): self.endianess = inp self.refresh_all() def process_minsize(self, opt): self.min_size = int(opt) self.refresh_all() def process_waffle(self, event_data): # Not sure if this is the best way, but it works waffleno = int(event_data.y / (event_data.widget.pixel_size + event_data.widget.pad)) waffleno = event_data.widget.height - (waffleno + 1) # Get WafflePixel based on calculation above - reversed to take into account multiple waffles idx = 0 for w in reversed(self.waffle_list): # Skip over invisible waffles if w.visible == False: continue if event_data.widget == w: break idx += 1 # See what bit needs to be changed bit = self.no_bits * idx + waffleno if self.value & (1 << bit): self.value &= ~(1 << bit) else: self.value |= (1 << bit) # Refresh display self.refresh_all() def process_reglist(self, selected): if selected == "OFF": for b in self.box_list: b.hide() self.bit_map = {} self.refresh_all() return tmp = self.in_excel[selected] self.bit_map = {} for row in tmp.iter_rows(): try: bits = row[0].value if bits == None: break except IndexError: break name = row[1].value descr = row[2].value try: bit = int(bits) self.bit_map[bit] = name self.bit_descr[bit] = descr except ValueError: if bits == "Bits": continue else: bits = str.replace(bits, "–", "-") interval = bits.split("-") for i in range(int(interval[0]), int(interval[1]) + 1): self.bit_map[i] = name self.bit_descr[i] = descr self.refresh_all() def refresh_all(self): if "0x" in self.input.value: self.input.value = hex(self.value) else: self.input.value = str(self.value) # TODO: improve? self.display_hex() self.display_bin() self.display_waffle() def display_hex(self): self.out_hex.value = hex(self.value) def display_bin(self): # Get binary without 0b outstring = bin(self.value)[2:] n = len(outstring) # Add zeros at beginning if needed while n % self.min_size != 0: outstring = "0" + outstring n += 1 # Split in groups of no_bits tmp = "" for idx in range(0, len(outstring)): tmp += outstring[idx] if (idx + 1) % self.no_bits == 0: tmp += " " outstring = tmp[:-1] # Handles endianess if self.endianess == "little": tmp = "" for elem in reversed(outstring.split(" ")): tmp += elem + " " outstring = tmp self.out_num.value = "0" + (" " * 140) + "31" self.out_bin.value = outstring def display_waffle(self): # Display new ones, based on the binary representation of the number idx = 0 x_coord = 0 # Dinamically add waffles if needed no_waffles = len(self.out_bin.value.split(" ")) if no_waffles > len(self.waffle_list): self.append_wb(no_waffles - len(self.waffle_list)) for elem in self.out_bin.value.split(" "): # Somehow it gets a empty element, fix this if elem == "": break # Get the waffle w = self.waffle_list[x_coord] w.show() # Display it if len(self.bit_map) != 0: b = self.box_list[x_coord] b.show() txlist = self.text_list[x_coord] # Set the individual pixel for i in range(0, len(elem)): if len(self.bit_map) != 0: txlist[i].show() txlist[i].value = str(idx) + ": " + self.bit_map[idx] + " " * 5 idx += 1 wp = w.pixel(0, i) if elem[i] == "1": wp.color = "blue" else: wp.color = "white" x_coord += 1 for i in range(x_coord, len(self.waffle_list)): self.waffle_list[i].hide() self.box_list[i].hide()
from guizero import App, PushButton, Box, Window, Text widthPx = 1280 heightPx = 1024 #print(widthPx, widthPx //2) app = App(title="Main Window", width=widthPx, height=heightPx) presetWindow = Window(app, title="Preset Window") presetText = Text(presetWindow, text="Hello") presetWindow.hide() page = "main" def setPage(cmd): page = cmd print(page) if page == 'preset': presetWindow.show(wait=True) topBox = Box(app, width='fill', height='fill', align='top', border=True) preset = PushButton(topBox, text="Load from Preset", width=30, height='fill', align='left', command=setPage("preset")) disk = PushButton(topBox, text="Load from Disk", width=30,
from guizero import App, Window, TextBox, Text, PushButton app = App(title= "Login Screen", layout= "grid", bg="#add8e6", height=200) #initialise app window = Window(app, title= "GUI") #initialise second window window.hide() #hide second window def check_cred(): text = Text(app, grid=[0,2]) if username_txt.value == user_un and password_txt.value == user_pw: window.show() app.hide() else: text = Text(app, text="Incorrect Credentials", grid=[0,3]) #define variables user_un = 'Nicholas' user_pw = "ABClike123" #Set Obects on first screen username_txt = TextBox(app, grid=[0,0]) password_txt = TextBox(app, grid=[0,1]) PushButton(app, command=check_cred, grid = [0,2], text= "Login") #Set Objects on Second Screen PushButton(window, grid = [1,1], text= "Good Job You remember'd your password.") app.display()
def editor_launcher(): 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 text_click(box): key_pad.show(wait=True) key_pad.focus() text_input.value = box.widget.value make_keyboard("num", box) def save(is_it_from_save_butt, save_new_file): global json_file for values in json_file: if values == "stages": for subtitle in json_file[values]: coords = [] for coord in json_file[values][subtitle]: entry = coord.value coords.append(int(entry)) json_file[values][subtitle] = coords elif values == "profile": list_of_coords = [] for subtitle in json_file[values]: coords = [] for coord in subtitle: entry = coord.value coords.append(int(entry)) list_of_coords.append(coords) json_file[values] = list_of_coords elif values == "temp_range" or values == "time_range": coords = [] for coord in json_file[values]: entry = coord.value coords.append(int(entry)) json_file[values] = coords else: entry = json_file[values].value json_file[values] = entry if is_it_from_save_butt == True: with open("profiles/" + file_display.value, mode="w") as fpr: json.dump(json_file, fpr) fpr.close() file_load(file_display.value) else: with open("profiles/" + save_new_file, mode="w") as fpr: json.dump(json_file, fpr) fpr.close() file_load(save_new_file) file_display.append(save_new_file) file_display.value = save_new_file def get_profile_list(): f = [] try: for (dirpath, dirnames, filenames) in os.walk("./profiles/"): f.extend(filenames) break except: return f return f def file_load(selected_file): global json_file while len(box2.children) > 0: for child in box2.children: child.destroy() with open("profiles/" + selected_file, mode="r") as fpr: json_file = json.load(fpr) fpr.close() row = 3 for values in json_file: if values == "stages": row = 1 entry = Text(box2, text=values, color="blue", grid=[3, row]) entry = Text(box2, text="Time", color="yellow", grid=[5, row]) entry = Text(box2, text="Temperature", color="yellow", grid=[6, row]) row += 1 for subtitle in json_file[values]: entry = Text(box2, text=subtitle, color="yellow", grid=[4, row]) x = 5 coords = [] for coord in json_file[values][subtitle]: entry = TextBox(box2, coord, grid=[x, row]) entry.when_left_button_released = text_click entry.bg = "white" coords.append(entry) x += 1 json_file[values][subtitle] = coords row += 1 elif values == "profile": row = 1 entry = Text(box2, text=values, color="blue", grid=[7, row]) entry = Text(box2, text="Time", color="yellow", grid=[8, row]) entry = Text(box2, text="Temperature", color="yellow", grid=[9, row]) row += 1 list_of_coords = [] for subtitle in json_file[values]: x = 8 coords = [] for coord in subtitle: entry = TextBox(box2, coord, grid=[x, row]) entry.when_left_button_released = text_click entry.bg = "white" coords.append(entry) x += 1 row += 1 list_of_coords.append(coords) 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 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" global add_button global subtract_button 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[values] = list_of_coords elif values == "temp_range" or values == "time_range": entry = Text(box2, text=values, color="blue", grid=[0, row]) entry = Text(box2, text="min", color="yellow", grid=[1, row]) entry = Text(box2, text="max", color="yellow", grid=[2, row]) row += 1 x = 1 coords = [] for coord in json_file[values]: entry = TextBox(box2, coord, grid=[x, row]) entry.when_left_button_released = text_click entry.bg = "white" coords.append(entry) x += 1 json_file[values] = coords row += 1 else: entry = Text(box2, text=values, color="blue", grid=[0, row]) entry = TextBox(box2, json_file[values], grid=[1, row]) entry.when_left_button_released = text_click entry.bg = "white" json_file[values] = entry row += 1 json_editor_window = Window(app, bg="black", width=800, height=480, layout="auto") Text(json_editor_window, text="Profile Editor", color="blue", size=15) box3 = Box(json_editor_window, layout="grid") file_display = Combo(box3, options=get_profile_list(), command=file_load, grid=[0, 0]) def delete_profile(): global file_display os.remove("profiles/" + file_display.value) file_display.destroy() file_display = Combo(box3, options=get_profile_list(), command=file_load, grid=[0, 0]) file_display.size = 24 file_display.bg = "white" file_load(file_display.value) delete_file = PushButton(box3, grid=[1, 0], command=delete_profile, text="delete") delete_file.bg = "white" file_display.size = 24 file_display.bg = "white" box1 = Box(json_editor_window) copy_button = PushButton(box1, command=copy, text="copy", align="left") copy_button.bg = "white" save_button = PushButton(box1, command=save, text="save", enabled=True, align="left", args=[True, 0]) save_button.bg = "white" box2 = Box(json_editor_window, layout="grid") # json_editor_window.set_full_screen() key_pad = Window( json_editor_window, title="key_pad", width=800, height=480, ) # key_pad.set_full_screen() text_input = TextBox(key_pad, width="fill") key_pad.hide() def make_keyboard(key_board, field=0): def enter_text(text): old_string = text_input.value new_string = old_string + str(text) text_input.value = new_string key_box = Box(key_pad, layout="grid") def switch_keyboard(argument): # print("switch") key_box.destroy() cancel_button.destroy() ok_button.destroy() make_keyboard(argument, field) if key_board == "num": for button in range(0, 10): key_button = PushButton(key_box, text=str(button), padx=16, grid=[button % 3, button // 3 + 1], command=enter_text, args=[button]) key_button.bg = "white" def back_space(): old_string = text_input.value new_string = old_string[0:len(old_string) - 1] text_input.value = new_string key_button = PushButton(key_box, text="<X|", grid=[11 % 3, 11 // 3 + 1], command=back_space) key_button.bg = "white" key_button = PushButton(key_box, text="abc", grid=[10 % 3, 10 // 3 + 1], command=switch_keyboard, args=["alph"]) key_button.bg = "white" elif key_board == "alph": row = 0 characters = ["qwertyuiop[]", "asdfghjkl;'", "zxcvbnm,./", " "] for string in characters: column = 0 if len(string) == 1: button = string[0] key_button = PushButton(key_box, text=str(button), padx=100, grid=[column, row, 12, 1], command=enter_text, args=[button]) key_button.bg = "white" else: for button in string: key_button = PushButton(key_box, text=str(button), padx=16, grid=[column, row], command=enter_text, args=[button]) key_button.bg = "white" column += 1 if row == len(characters) - 2: button = PushButton(key_box, text="shift", padx=16, grid=[column, row], command=switch_keyboard, args=["ALPH"]) row += 1 def back_space(): old_string = text_input.value new_string = old_string[0:len(old_string) - 1] text_input.value = new_string key_button = PushButton(key_box, text="<X|", grid=[11 % 3, 11 // 3 + 1], command=back_space) key_button.bg = "white" key_button = PushButton(key_box, text="123", grid=[10 % 3, 10 // 3 + 1], command=switch_keyboard, args=["num"]) key_button.bg = "white" elif key_board == "ALPH": row = 0 characters = ["QWERTYUIOP{}", "ASDFGHJKL:'", "ZXCVBNM<>?", " "] for string in characters: column = 0 if len(string) == 1: button = string[0] key_button = PushButton(key_box, text=str(button), padx=100, grid=[column, row, 12, 1], command=enter_text, args=[button]) key_button.bg = "white" else: for button in string: key_button = PushButton(key_box, text=str(button), padx=16, grid=[column, row], command=enter_text, args=[button]) key_button.bg = "white" column += 1 if row == len(characters) - 2: button = PushButton(key_box, text="shift", padx=16, grid=[column, row], command=switch_keyboard, args=["alph"]) row += 1 def back_space(): old_string = text_input.value new_string = old_string[0:len(old_string) - 1] text_input.value = new_string key_button = PushButton(key_box, text="<X|", grid=[11 % 3, 11 // 3 + 1], command=back_space) key_button.bg = "white" key_button = PushButton(key_box, text="123", grid=[10 % 3, 10 // 3 + 1], command=switch_keyboard, args=["num"]) key_button.bg = "white" def write_text(textbox): textbox.value = text_input.value key_pad.hide() cancel_button.destroy() ok_button.destroy() key_box.destroy() def cancel(): key_pad.hide() cancel_button.destroy() ok_button.destroy() key_box.destroy() ok_button = PushButton(key_pad, text="ok", command=write_text, args=[field.widget]) cancel_button = PushButton(key_pad, text="cancel", command=cancel) key_pad.when_closed = cancel file_load(file_display.value) json_editor_window.display()
text="START", command=start_program, grid=[0, 4], image="giantbean.gif") startbt.bg = "black" startbt.height = 170 startbt.width = 225 space = Text(startwdw, text="Click Bean to START", grid=[0, 5], size=26) window1 = Window(app, title="Coffee Roaster", width=480, height=320, layout="grid", bg="white") window1.hide() window1.tk.attributes("-fullscreen", True) #window1.show(wait=True) #welcome window space = Text(window1, text="", grid=[0, 0], size=3) Text1 = Text(window1, text=" Select Roast", grid=[0, 2], align="left", size=40, font="Helvetica") Text1 = Text(window1, text=" Operation", grid=[0, 3], align="left", size=40, font="Helvetica")
sleep(3) splashwindow.hide() #______________________________________________________________________ #MAIN PROGRAM readfile() #read the settings RUN = True #setup the ui app = App(title = "Erelas monitoring system", visible = False) #app.tk.iconbitmap("icon.ico") settingswindow = Window(app, title="Erelas monitoring system - settings", layout="grid") settingswindow.hide() aboutwindow = Window(app, title= "About") aboutwindow.hide() errorwindow = Window(app, title= "Error occured") errorwindow.hide() firstwindow = Window(app, title="Erelas monitoring system - first run") firstwindow.hide() #intiate the threads uithread = threading.Thread(target=traymenu) uithread.start() checkthread = threading.Thread(target=checkingloop) checkthread.start() #intitiate display
from guizero import App, Window, TextBox, Text, PushButton app = App(title='Login Screen', layout='grid') # inialise app window window = Window(app, title='GUI', layout='grid') # initialise 2nd screen window.hide() # hide 2nd screen user_un = 'sinclair' # stored credentials user_pw = 'letmein' username_txt = TextBox(app, grid=[0, 0]) # initialise textboxes password_txt = TextBox(app, grid=[0, 1]) def check_cred(): text = Text(app, grid=[0, 2]) text.clear() if username_txt.value == user_un and password_txt.value == user_pw: window.show() else: text = Text(app, text='Incorrect Credentials', grid=[0, 4]) submit = PushButton(app, text='SUBMIT!', grid=[0, 3], command=check_cred) app.display()
class Gui(object): 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() # Helper functions: windows def open_option_window(self): self.option_window.show(wait=True) self.option_window.set_full_screen() def close_option_window(self): self.option_window.exit_full_screen() self.option_window.hide() self.app.display() def open_dispensing_window(self): self.dispensing_window.show(wait=True) self.dispensing_window.set_full_screen() def close_dispensing_window(self): self.dispensing_window.exit_full_screen() self.dispensing_window.hide() self.open_option_window() def open_salt_dispensing_window(self): self.dispensing_id_text = SALT_DISPENSING_TEXT self.dispensing_text.set(self.dispensing_id_text) self.open_dispensing_window() def open_pepper_dispensing_window(self): self.dispensing_id_text = PEPPER_DISPENSING_TEXT self.dispensing_text.set(self.dispensing_id_text) self.open_dispensing_window() # Helper functions: dispensing def add_a_smidgen(self): self.smidgen_number += 1 self.smidgen_number_text.set(str(self.smidgen_number) + " Smidgen(s)") self.dispensing_amount += GRAMS_SALT_PER_TEASPOON/SMIDGENS_PER_TEASPOON if self.dispensing_id == Spices.SALT \ else GRAMS_PEPPER_PER_TEASPOON/SMIDGENS_PER_TEASPOON def add_a_pinch(self): self.pinch_number += 1 self.pinch_number_text.set(str(self.pinch_number) + " Pinch(es)") self.dispensing_amount += GRAMS_SALT_PER_TEASPOON/PINCHES_PER_TEASPOON if self.dispensing_id == Spices.SALT \ else GRAMS_PEPPER_PER_TEASPOON/PINCHES_PER_TEASPOON def add_a_dash(self): self.dash_number += 1 self.dash_number_text.set(str(self.dash_number) + " Dash(es)") self.dispensing_amount += GRAMS_SALT_PER_TEASPOON/DASHES_PER_TEASPOON if self.dispensing_id == Spices.SALT \ else GRAMS_PEPPER_PER_TEASPOON/DASHES_PER_TEASPOON def add_a_teaspoon(self): self.teaspoon_number += 1 self.teaspoon_number_text.set(str(self.teaspoon_number) + " Teaspoon(es)") self.dispensing_amount += GRAMS_SALT_PER_TEASPOON if self.dispensing_id == Spices.SALT \ else GRAMS_PEPPER_PER_TEASPOON def final_dispense(self): self.dispensing_flag = True self.close_dispensing_window() # Return to the dispensing window self.open_option_window() # Return to the option window def ready_to_dispense(self): return self.dispensing_flag def get_slot_id(self): return self.dispensing_id def get_amount_in_grams(self): return self.dispensing_amount def reset_measurement(self): self.smidgen_number = 0 self.smidgen_number_text.set(str(self.smidgen_number) + " Smidgen(s)") self.pinch_number = 0 self.pinch_number_text.set(str(self.pinch_number) + " Pinch(es)") self.dash_number = 0 self.dash_number_text.set(str(self.dash_number) + " Dash(es)") self.teaspoon_number = 0 self.teaspoon_number_text.set(str(self.teaspoon_number) + " Teaspoon(es)")
def gotoPic(): picture_widget.show() def backfromPic(window): parent_widget.hide() parent_widget = App(title="PythonGUI with 5 design widgets") picture_widget = Window(parent_widget, title="guizero picture widget", width=500, height=270, layout="grid") picture_widget.hide() picture1 = Picture(picture_widget, image="Outer_space.png", grid=[0, 0]) picture2 = Picture(picture_widget, image="parallax2.png", grid=[1, 0]) picture3 = Picture(picture_widget, image="setup.png", grid=[2, 0, 1, 2]) picture4 = Picture(picture_widget, image="comp.gif", grid=[0, 1, 2, 1]) picture_btn = PushButton(parent_widget, text="Picture Widget", command=gotoPic) warn_btn = PushButton(parent_widget, text="Warn Widget", command=warn_btnMethod) yesno_btn = PushButton(parent_widget, text="yesno Widget", command=yesnoMethod) button_widget = PushButton(parent_widget, text="Button Widget", command=buttonMethod) text_widget = PushButton(parent_widget, text="Text Widget", command=textMethod)
from guizero import App, Text, Box, TextBox, PushButton, Window main_app = App(title="Timer", layout="auto", width=200, height=100) timertwo = Window(main_app, title="Timer #2") timertwo.hide() seconds = Text(main_app, text="0", width="fill", height="fill") def end_all(): main_app.destroy() def timer(): seconds.value = int(seconds.value) + 1 def timer_begin(): seconds.repeat(1000, timer) def timer_pause(): starttimer.cancel(timer) starttimer = PushButton(main_app, text="Start timer", command=timer_begin, align="left", width="fill") pausetimer = PushButton(main_app,
class piDSLM: 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="- PiDSLM -") button1 = PushButton(self.app, grid=[1, 1], width=110, height=110, pady=35, padx=10, image="/home/pi/piDSLM/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/piDSLM/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/piDSLM/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/piDSLM/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/piDSLM/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/piDSLM/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/piDSLM/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/piDSLM/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 clear(self): self.show_busy() os.system("rm -v /home/pi/Downloads/*") self.hide_busy() def show_busy(self): self.busy.show() print("busy now") def hide_busy(self): self.busy.hide() print("no longer busy") def fullscreen(self): self.app.tk.attributes("-fullscreen", True) def notfullscreen(self): self.app.tk.attributes("-fullscreen", False) # Generate timestamp string generating name for photos def timestamp(self): tstring = datetime.datetime.now() #print("Filename generated ...") return tstring.strftime("%Y%m%d_%H%M%S") def burst(self): self.show_busy() capture_number = self.timestamp() print("Raspistill starts") os.system( "raspistill -t 10000 -tl 0 --thumb none -n -bm -o /home/pi/Downloads/BR" + str(capture_number) + "%04d.jpg") print("Raspistill done") self.hide_busy() def split_hd_30m(self): self.show_busy() capture_number = self.timestamp() print("Raspivid starts") os.system("raspivid -f -t 1800000 -sg 300000 -o /home/pi/Downloads/" + str(capture_number) + "vid%04d.h264") print("done") self.hide_busy() def lapse(self): self.show_busy() capture_number = self.timestamp() print("Raspistill timelapse starts") os.system( "raspistill -t 3600000 -tl 60000 --thumb none -n -bm -o /home/pi/Downloads/TL" + str(capture_number) + "%04d.jpg") print("Raspistill timelapse done") self.hide_busy() def long_preview(self): self.show_busy() print("15 second preview") os.system("raspistill -f -t 15000") self.hide_busy() def capture_image(self): self.show_busy() capture_number = self.timestamp() print("Raspistill starts") os.system("raspistill -f -o /home/pi/Downloads/" + str(capture_number) + "cam.jpg") print("Raspistill done") self.hide_busy() def takePicture(self, channel): print("Button event callback") capture_number = self.timestamp() print("Raspistill starts") os.system("raspistill -f -t 3500 -o /home/pi/Downloads/" + str(capture_number) + "cam.jpg") print("Raspistill done") def picture_left(self): if (self.picture_index == 0): self.pictures = (len(self.saved_pictures) - 1) self.picture_index -= 1 self.shown_picture = self.saved_pictures[self.picture_index] self.picture_gallery = Picture(self.gallery, width=360, height=270, image=self.shown_picture, grid=[1, 0]) def picture_right(self): if (self.picture_index == (len(self.saved_pictures) - 1)): self.picture_index = 0 self.picture_index += 1 self.shown_picture = self.saved_pictures[self.picture_index] self.picture_gallery = Picture(self.gallery, width=360, height=270, image=self.shown_picture, grid=[1, 0]) def show_gallery(self): self.gallery = Window(self.app, bg="white", height=300, width=460, layout="grid", title="Gallery") self.saved_pictures = glob.glob('/home/pi/Downloads/*.jpg') self.shown_picture = self.saved_pictures[self.picture_index] button_left = PushButton(self.gallery, grid=[0, 0], width=40, height=50, pady=50, padx=10, image="/home/pi/piDSLM/icon/left.png", command=self.picture_left) self.picture_gallery = Picture(self.gallery, width=360, height=270, image=self.shown_picture, grid=[1, 0]) button_right = PushButton(self.gallery, grid=[2, 0], width=40, height=50, pady=50, padx=10, image="/home/pi/piDSLM/icon/right.png", command=self.picture_right) self.gallery.show() def video_capture(self): self.show_busy() capture_number = self.timestamp() print("Raspivid starts") os.system("raspivid -f -t 30000 -o /home/pi/Downloads/" + str(capture_number) + "vid.h264") print("done") self.hide_busy() def upload(self): self.show_busy() subprocess.Popen( ["python3", "/home/pi/piDSLM/dropbox_upload.py", "--yes"]) self.hide_busy()
def findTweets(): user = textBox.value app.hide() # Loading Window Appears loadingWindow = Window(app, title="Loading Tweets", visible=True) loadingText = Text(loadingWindow, text="Loading Tweets... This may take up to 30 seconds") loadingWindow.update() # Checking to make sure everything is working on console print(user) myuser = api.get_user(screen_name=user) print(user, " has ", myuser.statuses_count, " total tweets") # Doing our first search so we can get our maxid to search from on the rest print("First Search...") for tweet in tw.Cursor(api.user_timeline, screen_name=user).items(200): tweets.append(tweet) for tweet in tweets: maxtweetid = tweet.id # Doing the rest of our searches resetting the maxid everytime. print("Rest of searches...") for x in range(0, 30): print(x, end=" ", flush=True) newtweets = tw.Cursor(api.user_timeline, screen_name=user, max_id=maxtweetid, count=0).items(100) for tweet in newtweets: maxtweetid = tweet.id tweets.append(tweet) tracker = 0 # Close our loading window loadingWindow.hide() tweetsWindow = Window(app, title="Tweets for @" + user) # Setting up our date stuff to print on window Format of datetime: YYYY-MM-DD createDate = str(myuser.created_at) createDate = createDate[:4] todayMonth = datetime.datetime.now() todayMonth = todayMonth.strftime("%B") todayDay = str(datetime.date.today()) todayDay = todayDay[8:10] todayYear = str(datetime.date.today()) todayYear = todayYear[0:4] text1 = Text(tweetsWindow, text="Tweet(s) from @" + user + " on " + todayMonth + " " + todayDay + " between " + createDate + "-" + todayYear) tweetsWindow.hide() myDate = str(datetime.date.today()) newDate = myDate[4:] # Setting our text in our tweet window for tweet in tweets: if newDate in tweet.created_at.strftime("%Y-%m-%d %H:%M:%S"): tracker = tracker + 1 text = Text(tweetsWindow, text="Tweet " + str(tracker) + ": \"" + tweet.text + "\"\n" + str(tweet.created_at) + "\n") # print("Tweet: ", tracker) # print("\"" + tweet.text + "\"") # print(tweet.created_at) # Display our tweets and program is concluded exitprogrambutton = PushButton(tweetsWindow, exitprogram, text="Exit") tweetsWindow.show()
text="Made by The Cool Guy 468 and Kidplayer_666", size=8) """Score stuff""" scoremenu = Window(app) Scoretext = Text(scoremenu, text="your score is") Actualscore = Text(scoremenu, text="0") restbutton2 = PushButton(scoremenu, text="Reset", command=resetthething) menubutton = PushButton(scoremenu, text="Menu", command=menubuttonthing) # Waffle setup here for experimental purposes, aka, level size testing waffle = Waffle(app, pad=0, grid=[1, 1], height=20, width=20, color="green", command=protec, dim=25) """Pixel shuffler""" pixels = [] for x in range(waffle.width): for y in range(waffle.height): pixels.append(waffle.pixel(x, y)) shuffle(pixels) """just starting the app""" app.repeat(750, propagate) startmenu.show() scoremenu.hide() app.hide() app.display()
endBtn = PushButton( startScr, text="Quit", command=windowClose, align="bottom", padx=0, pady=0, ) endBtn.width = 10 endBtn.height = 1 endBtn.text_color = "#ffffff" #white #SECOND WINDOW #TRIANGLE s0 = Window(startScr, title="Instructions", height=appH, width=appW, bg=appBG) s0.hide() #hides this window until player clicks on start button Text(s0, text="What is showing on the Bomb?", color="#ffffff", size=25) #colour: white Text(s0, text="", size=10) #spacer Text(s0, text=if_text) Text(s0, text="", size=10) #spacer Text(s0, text="Triangle", size=50) Text(s0, text="", size=10) #spacer Text(s0, text=instr) Text(s0, text="", size=15) #spacer Text(s0, text="Press the joystick 3 times", size=25) Text(s0, text="", size=15) #spacer PushButton(s0, text="Next Page", command=gotoScreen1) #THIRD WINDOW #FULL BLUE
align="bottom", padx=0, pady=0, ) endBtn.width = 10 endBtn.height = 1 endBtn.text_color = "#ffffff" #white #SECOND WINDOW #TRIANGLE s0 = Window(startScr, title="Instructions", height=appH, width=appW, bg=appBG) s0.hide() #hides this window until player clicks on start button Text(s0, text="What is showing on the Bomb?", color="#ffffff", size=25) #colour: white Text(s0, text="", size=10) #spacer Text(s0, text=if_text) Text(s0, text="", size=10) #spacer Text(s0, text="Triangle", size=50) Text(s0, text="", size=10) #spacer Text(s0, text=instr) Text(s0, text="", size=15) #spacer Text(s0, text="Up, Left, Right", size=25) Text(s0, text="", size=15) #spacer PushButton(s0, text="Next Page", command=gotoScreen1) #THIRD WINDOW #FULL BLUE
gstime_m_csv = [] getime_h_csv = [] getime_m_csv = [] gsum_csv = [] gdate_week_no = [] #Create a display app = App(title="Emplois du temps - IETR") title_box = Box(app, width="fill", align="top") reservation_box = Box(title_box, width=600, height=50, align="right") border_box = Box(app, height="fill", width="fill", align="top",layout="grid") row_box= [[0] * MAX_ROW for _ in range(MAX_COLUMN)] #Create second window for reservation window_reserv = Window(app,title="Reservation",height=400, width=400, layout="grid") window_reserv.hide() #hide by default #set language in french locale.setlocale(locale.LC_ALL, 'fr') #Define URL --for the moment we use edt setr for examples URL = 'http://edt-v2.univ-nantes.fr/calendar/ics?timetables[0]=42004' def init_data_array(): #clear data array global gdate_csv, gstime_h_csv, gstime_m_csv, getime_h_csv, getime_m_csv, gsum_csv gdate_csv.clear() gstime_h_csv.clear() gstime_m_csv.clear() getime_h_csv.clear() getime_m_csv.clear()
control_app.bg = 'black' control_app.font = 'Inter UI Bold' control_app.text_size = 10 control_app.height = 480 control_app.width = 800 control_app.tk.config(cursor='none') control_app.repeat(1000, thermalCountUp) # Feedback Window FeedbackWindow = Window(control_app) FeedbackWindow.text_size = 18 FeedbackWindow.font = 'Nexa Bold' FeedbackWindow.tk.attributes('-fullscreen', fullScreen) FeedbackWindow.height = 480 FeedbackWindow.width = 800 FeedbackWindow.hide() FeedbackWindow.bg = 'black' FeedbackWindow.tk.config(cursor='none') # buttons on feedback window gap = Text(FeedbackWindow,'') happy = Picture(FeedbackWindow, 'happy.gif') happy.when_clicked = goodFeedback gap = Text(FeedbackWindow,'') #happyText = Text(FeedbackWindow, text = 'I learned something\n new today!', grid = [1,0], color = 'white', align = 'left') confused = Picture(FeedbackWindow,'confused.gif') confused.when_clicked = badFeedback #confText = Text(FeedbackWindow, text = "I'm still not sure...", grid = [1,1], color = 'white', align = 'left') #smiley1 = PushButton(FeedbackWindow, text=':)', command=smiley1_callback) #smiley2 = PushButton(FeedbackWindow, text=':(', command=smiley2_callback)