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)
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" ##_____Code that gets run:__________## # help(STEREOMAINFILE_Server) app = App(title="S.T.A.R.S. User Interface", layout="grid", height=280, width=480, bg="#424242",visible=True) # MainBox = Box(app,grid=[0,0]) welcome_message = Text(app, "Welcome to S.T.A.R.S.", size=20, font="Calibri Bold", color="red", grid=[1,0,2,1]) player_sel = Combo(app,options=["Player1","Player2","Player3","Player4","Player5"],command=gui_app().player_selection,grid=[1,1,2,1]) player_sel.bg = "#424242" player_sel.text_color = "white" player_sel.text_size=14 Box(app,width=10,height=5,grid=[0,0]) # second_message = Text(app, "Please select a drill: ", size=14, font="Calibri Bold", color="green",grid=[1,1,2,1]) # logo = Picture(app, image="include/images/logo.png", align="left", grid=[0,0]) # logo.resize(75, 75) # logoright = Picture(app, image="include/images/logo.png", align="left", grid=[3,0]) # logoright.resize(75, 75) button_width = 17 print('looping') drill_1 = PushButton(app, command=gui_app().staticDrill, args=[app] ,text="Basic Tracking", grid=[1,2],width=17) drill_1.width = button_width drill_1.font="Calibri Bold" drill_1.bg="#006868" drill_1.text_color="white"
text = Text(a, text="colors") check = CheckBox(a, "check me") combo = Combo(a, ["red", "blue"]) button = PushButton(a) slider = Slider(a) b = Box(a) textbox = TextBox(b, text="or colours") bgroup = ButtonGroup(b, ["cheese", "ham", "salad"], 1) #a.bg = (255,255,0) text.text_color = "red" text.text_size = 30 text.font = "verdana" #text.bg = "green" check.bg = "#d41789" combo.bg = "blue" combo.text_color = None combo.text_size = 24 #button.bg = "black" button.text_color = (255, 0, 255) button.font = "arial" button.text_size = 18 slider.bg = (123, 234, 12) #textbox.bg = "cyan" textbox.font = "courier" textbox.text_color = "#FF0000" b.bg = "cyan" b.font = "wingdings" #bgroup.bg = "yellow" bgroup.text_color = "#e62112" bgroup.text_color = None
app.bg = (115, 160, 230) #app.tk.attributes("-fullscreen",True) # Widgets menubar = MenuBar(app, toplevel=["File", "Edit"], options=[ [ ["Today's Report", todays_report], [today.strftime("%Y Report"), yearly_report],\ ["Recent Reports", white_card_folder]], [ ["Today's List", open_window]] ]) title = Text(app, "Yard Crew", color="White", size=30, font="Quicksand Medium") tech = Combo(app, options=techCombo + ["Tech"], selected="Tech" , command=writeTech) tech.text_size = 30 tech.bg = "white" spacer = Box(app, width="fill", height=20) pic = Picture(app, image=str(main_image)) pic.width = 460 pic.height = 345 spacer2 = Box(app, width="fill", height=30) close = PushButton(app, text="Exit", command=close_app) # Second Window: Edit Today's List window = Window(app, title = "Edit Today's List", height=500, width=950, layout="grid") window.hide() lspacer = Box(window, grid=[0,0], width=20, height=500) left_box = Box(window, grid=[1,0]) mspacer = Box(window, grid=[2,0], width=40, height=500) right_box = Box(window, grid=[3,0])
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()
fpr.close() with open("profiles/" + config["profile"] + ".json", mode="r") as fpr: oven.sprofile = json.load(fpr) fpr.close() loadPlot() # print("plot loaded") file_box_1 = Box(controls_box) fileDisplay = Combo(file_box_1, options=getProfileList(), command=file_display_command, align="left") fileDisplay.size = 24 fileDisplay.bg = "white" 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
StopRecording = PushButton(app, command=stoprecording, text="stop recording") sizes = Combo(app, options=["normal 1080p", "instagram size", "vga"], command=sizes) effects = Combo(app, options=["none", "filter1", "filter2"], command=effects) effects.text_color = "Blue" effects.font = "Helvetica" effects.text_size = "20" effects.bg = "Yellow" isochanger = Slider(app, command=isochange, start=0, end=800, width=1500) isoteller = Text( app, text="Iso speed (Note:Leave on 0 for automatic!)", ) shutterspeed = Slider(app, command=shutterspeed, start=0, end=50000, width=1000) shutterspeedteller = Text(