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") 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" Spotifybutton = PushButton(app, command=Spotify_gui, image="Images/spotify_button.png", grid=[0, 5, 1, 1], align="right", width=50, height=50) Spotifybutton.bg = "black" 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
return switcher.get(description, "black") weather_font_color = which_color(description) Image_picture = which_image(description) 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,
#Gauge Needles radius = GaugeWidth/4 #Q1 Gauge Q1xc = radius Q1yc = radius Q1x = radius Q1y = 0 #///Q1 VARIABLES//// Q1Min = 32 Q1Max = 110 Q1Title = "Cab *F" Q1TitleSize = 13 #/////////////////// Q1TargetP = 0.0 Q1Needle = GaugeCluster.line(Q1xc, Q1yc, Q1x, Q1y, color="red", width=5) Q1MainText = GaugeCluster.text(Q1xc , Q1yc+10, text = Q1Title,size=Q1TitleSize) Q1MainReading = GaugeCluster.text(Q1xc , Q1yc+35, text = "0",size=14) Q1ErrorCount = 0 Q1MinText = GaugeCluster.text(Q1xc-30 , Q1yc+55, text = Q1Min,size=10) Q1MaxText = GaugeCluster.text(Q1xc+50, Q1yc-10, text = Q1Max,size=10) Q1Max1 = GaugeCluster.line(Q1xc, Q1yc,Q1xc + (math.cos((((100 - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), Q1yc + (math.sin((((100 - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), color="red", width=4) Q1Min1 = GaugeCluster.line(Q1xc, Q1yc,Q1xc + (math.cos((((0 - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), Q1yc + (math.sin((((0 - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), color="blue", width=4) Q1MaxRadius = GaugeWidth/6 for i in range(1, 10): Q1Dashes = GaugeCluster.line(Q1xc, Q1yc,Q1xc + (math.cos(((((i*10) - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), Q1yc + (math.sin(((((i*10) - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), color="black", width=2) for i in range(0, 11): Q1DashCover = GaugeCluster.line(Q1xc, Q1yc,Q1xc + (math.cos(((((i*10) - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * Q1MaxRadius), Q1yc + (math.sin(((((i*10) - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * Q1MaxRadius), color="white", width=5) #Q2 Gauge Q2xc = radius*3 Q2yc = radius Q2x = radius*2
def test_text(): a = App() d = Drawing(a) id = d.text(1, 2, "foo") assert id > 0 a.destroy()
300, 400, 250, 450, color="yellow", outline=5, outline_color="green") d.triangle(310, 400, 360, 400, 310, 450, color=None, outline=5, outline_color="green") d.image(10, 500, "guizero.png", width=350, height=100) d.text(10, 600, "guizero") d.text(110, 600, "guizero", font="times new roman") d.text(210, 600, "guizero", size=24) d.text(10, 650, "this is a some text which goes over the width and is wrapped", font="arial", size=16, max_width=350) a.display()