def test_clear(): a = App() d = Drawing(a) d.line(1, 2, 3, 4) d.oval(1, 2, 3, 4) assert len(d.tk.find_all()) == 2 d.clear() assert len(d.tk.find_all()) == 0 a.destroy()
def test_delete(): a = App() d = Drawing(a) id1 = d.line(1, 2, 3, 4) id2 = d.oval(1, 2, 3, 4) assert len(d.tk.find_all()) == 2 d.delete(id1) assert len(d.tk.find_all()) == 1 d.delete(id2) assert len(d.tk.find_all()) == 0 a.destroy()
text="EZ Make Oven Controller", font="Times New Roman", size=16, color="white", align="left") message = Text(app, text="Getting started", font="Times New Roman", size=14, color="white", align="top") indicator = Drawing(indicatorBox, 25, 25, align="right") indicator.oval(0, 00, 24, 24, color="black", outline=True, outline_color="white") #define the display panel alloy_label = Text(controls_box, text="Alloy:", size=14, color="blue") alloy_display = Text(controls_box, text="", size=12, color="white") profile_label = Text(controls_box, text="Profile:", size=14, color="blue") profile_display = Text(controls_box, text="", size=12, color="white") time_label = Text(controls_box, text="Time:", size=14, color="blue") time_dispay = Text(controls_box, text=0, size=16, color="white") temp_label = Text(controls_box, text="Temp (C):", size=14, color="blue") temp_display = Text(controls_box, text=0, size=16, color="white") last_temp = 0 last_state = "ready" last_control = False
from guizero import App, Drawing a = App() # create drawing object d = Drawing(a, width=220, height=220) d.rectangle(10, 10, 210, 210, color="dark blue") d.oval(30, 30, 50, 50, color="red", outline=True) d.oval(170, 30, 190, 50, color="white", outline=True) d.triangle(110, 90, 120, 110, 100, 110, color="black") d.line(50, 180, 50, 160, color="yellow", width=5) d.line(50, 180, 170, 180, color="yellow", width=5) d.line(170, 180, 170, 160, color="yellow", width=5) a.display()
def test_oval(): a = App() d = Drawing(a) id = d.oval(1, 2, 3, 4) assert id > 0 a.destroy()
#****************************************** #----------------TRACK MENU---------------- #****************************************** #TRACK = App(title="TRACK") TRACK = Window(OBC, title = "TRACK") TRACK.bg = "BLACK" #Gauge Face Cluster DrawingWidth = 300 DrawingHeight = 400 NumberOfGauges = 4 GaugeWidth = DrawingWidth GaugeHeight = 300 WarningWidth = DrawingWidth WarningHeight = 100 GaugeCluster = Drawing(TRACK, width=DrawingWidth, height=DrawingHeight) GaugeCluster.oval(0, 0, GaugeWidth/(NumberOfGauges/2), GaugeHeight/(NumberOfGauges/2), color="white", outline=True) GaugeCluster.oval(GaugeWidth/(NumberOfGauges/2), 0, GaugeWidth, GaugeHeight/(NumberOfGauges/2), color="white", outline=True) GaugeCluster.oval(0, GaugeHeight, GaugeWidth/(NumberOfGauges/2), GaugeHeight/(NumberOfGauges/2), color="white", outline=True) GaugeCluster.oval(GaugeWidth/(NumberOfGauges/2), GaugeHeight, GaugeWidth, GaugeHeight/(NumberOfGauges/2), color="white", outline=True) #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
a = App(width=370, height=700) # create drawing object d = Drawing(a, width="fill", height="fill") d.bg = "light blue" # draw the shapes d.rectangle(10, 10, 60, 60) d.rectangle(70, 10, 120, 60, color="yellow") d.rectangle(130, 10, 180, 60, color="yellow", outline=True) d.rectangle(190, 10, 240, 60, color="yellow", outline=5) d.rectangle(250, 10, 300, 60, color="yellow", outline=5, outline_color="green") d.rectangle(310, 10, 360, 60, color=None, outline=5, outline_color="red") d.oval(10, 100, 60, 150) d.oval(70, 100, 120, 200, color="yellow") d.oval(130, 100, 240, 150, color="yellow", outline=True) d.oval(130, 160, 240, 210, color="yellow", outline=5) d.oval(250, 100, 300, 150, color="yellow", outline=5, outline_color="green") d.oval(310, 100, 360, 150, color=None, outline=5, outline_color="red") d.line(10, 250, 60, 250) d.line(70, 250, 120, 250, color="yellow") d.line(130, 250, 240, 250, width=5) d.line(250, 250, 300, 250, width=5, color="green") d.line(310, 250, 360, 250, width=5, color="red") d.polygon(10, 300, 60, 300, 40, 350, 10, 350) d.polygon(70, 300, 120, 300, 100, 350, 70, 350, color="yellow") d.polygon(130, 300, 180, 300, 160, 350, 130, 350, color="yellow", outline=True)
def secondfunc(): global pin8_flag, pin9_flag, pin10_flag, pin11_flag, d0_value, d1_value, d2_value, d3_value, a0_value, a1_value, a2_value, a3_value global a0_textbox, a1_textbox, a2_textbox, a3_textbox, run_update, circle_2, circle_3, circle_4, circle_5 pin8_flag = "0" pin9_flag = "0" pin10_flag = "0" pin11_flag = "0" a0_value = "0" a1_value = "0" a2_value = "0" a3_value = "0" d0_value = "0" d1_value = "0" d2_value = "0" d3_value = "0" app.bg = "#00cc99" app.width = 400 app.height = 300 wanted_text = Text(app, "IO data acquisition system GUI") wanted_text.text_size = 12 wanted_text.font = "Times New Roman" wanted_text.text_color = "#000000" Box_input_digital = Box(app, layout="grid", border=1) digital_text = Text(Box_input_digital, "Input digital", grid=[0, 0]) circle_2 = Drawing(Box_input_digital, height=11, width=11, grid=[0, 1]) circle_3 = Drawing(Box_input_digital, height=11, width=11, grid=[1, 1]) circle_4 = Drawing(Box_input_digital, height=11, width=11, grid=[2, 1]) circle_5 = Drawing(Box_input_digital, height=11, width=11, grid=[3, 1]) box_output = Box(app, layout="grid", border=1) pin8_button = PushButton(box_output, text="pin8", command=pin8_out, grid=[0, 0]) pin9_button = PushButton(box_output, text="pin9", command=pin9_out, grid=[1, 0]) pin10_button = PushButton(box_output, text="pin10", command=pin10_out, grid=[0, 1]) pin11_button = PushButton(box_output, text="pin11", command=pin11_out, grid=[1, 1]) circle_2.oval(0, 0, 10, 10, color="black", outline=True, outline_color="black") circle_3.oval(0, 0, 10, 10, color="black", outline=True, outline_color="black") circle_4.oval(0, 0, 10, 10, color="black", outline=True, outline_color="black") circle_5.oval(0, 0, 10, 10, color="black", outline=True, outline_color="black") circle_2_text = Text(Box_input_digital, "2", grid=[0, 2]) circle_2_text = Text(Box_input_digital, "3", grid=[1, 2]) circle_2_text = Text(Box_input_digital, "4", grid=[2, 2]) circle_2_text = Text(Box_input_digital, "5", grid=[3, 2]) box_input_analog = Box(app, layout="grid", border=1) a0_text = Text(box_input_analog, "A0", grid=[0, 0]) a1_text = Text(box_input_analog, "A1", grid=[0, 1]) a2_text = Text(box_input_analog, "A2", grid=[0, 2]) a3_text = Text(box_input_analog, "A3", grid=[0, 3]) a0_textbox = TextBox(box_input_analog, text=a0_value, grid=[1, 0]) a1_textbox = TextBox(box_input_analog, text=a1_value, grid=[1, 1]) a2_textbox = TextBox(box_input_analog, text=a2_value, grid=[1, 2]) a3_textbox = TextBox(box_input_analog, text=a3_value, grid=[1, 3]) button_exit = PushButton(app, text="Exit", command=exit_program) return app