def spin_up_editable_texts(parent, command): texts = [] global item_name_text item_name_text = Text(parent, width='fill', color=display_config.text_color, font=display_config.text_font, size=display_config.text_size, grid=[2, 3], align='left') global item_quantity_text item_quantity_text = Text(parent, width='fill', color=display_config.text_color, font=display_config.text_font, size=display_config.text_size, grid=[2, 4], align='left') global item_size_text item_size_text = Text(parent, width='fill', color=display_config.text_color, font=display_config.text_font, size=display_config.text_size, grid=[2, 5], align='left') global item_name_text_box item_name_text_box = TextBox(parent, width=45, grid=[2, 3, 2, 1], align='left') item_name_text_box.text_color = display_config.text_color item_name_text_box.font = display_config.text_font item_name_text_box.text_size = display_config.text_size item_name_text_box.when_clicked = command global item_quantity_text_box item_quantity_text_box = TextBox(parent, width=10, grid=[2, 4], align='left') item_quantity_text_box.text_color = display_config.text_color item_quantity_text_box.font = display_config.text_font item_quantity_text_box.text_size = display_config.text_size item_quantity_text_box.when_clicked = command global item_size_text_box item_size_text_box = TextBox(parent, width=10, grid=[2, 5], align='left') item_size_text_box.text_color = display_config.text_color item_size_text_box.font = display_config.text_font item_size_text_box.text_size = display_config.text_size item_size_text_box.when_clicked = command
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 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()
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" #Destroy Keyboard box def Destroy_keys(): global Keyboard_box global app global keys_exist keys_exist = 0 Keyboard_box.destroy() app.focus() Add_textbox.when_clicked = Make_keys Time_display.repeat(1000, time_update) Weather_drawing.repeat(600000, update_weather) app.display()
save_img_check = CheckBox(app, text="Keep images?", grid=[1, 1], align="left") Text(app, "Specify save directory:", size=10, color="#000000") save_img_dir = TextBox(app, width=20, text="/home/pi/Desktop/4-19/") #Sampling sample_freq_text = Text(app, text="Specify sample frequency:", size=10, color="#000000") sample_frequency = ButtonGroup(app, options=[["1min", "60"],["30min", "1800"], ["1hr", "3600"], ["2hr", "7200"], ["6hr", "21600"], ["12hr", "43200"]], selected="1", horizontal=True, grid=[1, 2], align="left") #Sample Volume sample_volume_box = Text(app, text="Specify sample volume (uL):", size=10, color="#000000") sample_volume = TextBox(app, width=3, text="1") #Save Button save_button = PushButton(app, text="Save Settings?") save_button.bg = "#ff4b4b" save_button.when_clicked = save_inputs input_log_name.when_clicked = reset save_img_check.when_clicked = reset save_img_dir.when_clicked = reset sample_frequency.when_clicked = reset sample_volume_box.when_clicked = reset #Calibrate Button cal_button = PushButton(app, text="Calibrate MicrobeScope") cal_button.when_clicked = calibrate #Run Button run_button = PushButton(app, text="Run MicrobeScope") run_button.when_clicked = run #Stop Button Text(app, "To stop, enter Ctrl+C in the command line.", size=12, color="#000000")