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()
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()
# coding: utf-8 from guizero import App, Drawing a = App() # create drawing object d = Drawing(a, width=220, height=220) d.rectangle(10, 10, 210, 210, color="light blue") d.oval(30, 30, 50, 50, color="white", 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="red", width=5) d.line(50, 180, 170, 180, color="red", width=5) d.line(170, 180, 170, 160, color="red", width=5) a.display()
def test_line(): a = App() d = Drawing(a) id = d.line(1, 2, 3, 4) assert id > 0 a.destroy()
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 #/////////////////// 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
# 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) d.polygon(190, 300, 240, 300, 220, 350, 190, 350, color="yellow", outline=5) d.polygon(250, 300, 300, 300, 280, 350,