Пример #1
0
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()
'''
Zora Johnson
ITN 160
Guizero Widget Project
'''

from guizero import App, Text
app = App()
text = Text(app, text="Hey Everyone")
text = Text(app, text="hi")
text.text_color = "green"

from guizero import App, Drawing
app = App()
drawing = Drawing(app)
drawing.rectangle(10, 10, 60, 60, color="purple")

app.display()

app.display()
Пример #3
0
# 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()
Пример #4
0
def test_rectangle():
    a = App()
    d = Drawing(a)
    id = d.rectangle(1, 2, 3, 4)
    assert id > 0
    a.destroy()
Пример #5
0
Q4MinText = GaugeCluster.text(Q4xc-30 , Q4yc+55, text = Q4Min,size=10)
Q4MaxText = GaugeCluster.text(Q4xc+50, Q4yc-10, text = Q4Max,size=10)
Q4Max1 = GaugeCluster.line(Q4xc, Q4yc,Q4xc + (math.cos((((100 - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), Q4yc + (math.sin((((100 - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), color="red", width=4)
Q4Min1 = GaugeCluster.line(Q4xc, Q4yc,Q4xc + (math.cos((((0 - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), Q4yc + (math.sin((((0 - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), color="blue", width=4)
Q4MaxRadius = GaugeWidth/6
for i in range(1, 10):
    Q4Dashes = GaugeCluster.line(Q4xc, Q4yc,Q4xc + (math.cos(((((i*10) - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * radius), Q4yc + (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):
    Q4DashCover = GaugeCluster.line(Q4xc, Q4yc,Q4xc + (math.cos(((((i*10) - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * Q4MaxRadius), Q4yc + (math.sin(((((i*10) - 0) * ((3.141592 * 1.25) - 0)) / (100 - 0))-(3.141592 / .75)) * Q4MaxRadius), color="white", width=5)
#Warning Bar 1
WB1x1 = 0
WB1y1 = 300
WB1x2 = 100
WB1y2 = 400
WB1Color = "black"
WB1 = GaugeCluster.rectangle(WB1x1, WB1y1, WB1x2, WB1y2, color="white")
WB1 = GaugeCluster.rectangle(WB1x1+5, WB1y1+5, WB1x2-5, WB1y2-5, color=WB1Color)
#Warning Bar 2
WB2x1 = 100
WB2y1 = 300
WB2x2 = 200
WB2y2 = 400
WB2Color = "black"
WB2 = GaugeCluster.rectangle(WB2x1, WB2y1, WB2x2, WB2y2, color="white")
WB2 = GaugeCluster.rectangle(WB2x1+5, WB2y1+5, WB2x2-5, WB2y2-5, color=WB2Color)
#Warning Bar 3
WB3x1 = 200
WB3y1 = 300
WB3x2 = 300
WB3y2 = 400
WB3Color = "black"
Пример #6
0
from guizero import App, Drawing

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")
Пример #7
0
app = App(width=width, height=height)

# 윈도우 크기를 최대화 함.
app.tk.attributes("-fullscreen", True)

# Drawing 객체 생성.
d = Drawing(app, width=width, height=height)

w = width
h = height

d.rectangle(0,
            0,
            w,
            h,
            color="light blue",
            outline=True,
            outline_color="white")

# GPIO 초기화
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.cleanup()

# 14 번 GPIO 핀을 통하여 습도, 온도를 읽어 들임.
dht11 = dht11.DHT11(pin=14)

# 시간을 한국 시간에 맞추는 방법
# 아래의 명령어를 터미널에서 실행한다.
# $ sudo apt install ntpdate