def test_repeat_schedule(): a = App() d = Drawing(a) schedule_repeat_test(a, d) a.destroy()
def test_text(): a = App() d = Drawing(a) id = d.text(1,2,"foo") assert id > 0 a.destroy()
def test_after_schedule(): a = App() d = Drawing(a) schedule_after_test(a, d) a.destroy()
def start(event): painting.last_event = event def draw(event): painting.line(painting.last_event.x, painting.last_event.y, event.x, event.y, color=color.value, width=width.value) painting.last_event = event # ------------------------------ # App # ------------------------------ app = App("Paint") color = Combo(app, options=["black", "white", "red", "green", "blue"]) width = Slider(app, start=1, end=10) painting = Drawing(app, width="fill", height="fill") painting.when_left_button_pressed = start painting.when_mouse_dragged = draw app.display()
def test_image(): a = App() d = Drawing(a) id = d.image(1,2,"../examples/guizero.gif") assert id > 0 a.destroy()
def test_display(): a = App() d = Drawing(a) display_test(d) a.destroy()
def test_inherited_properties(): a = App() inherited_properties_test(a, lambda: Drawing(a), False) a.destroy()
spacerb = Text(app, text="") # Spacer B clear = PushButton(app, clearlist, text="Clear list") # Clear list button clear.bg = "#565656" clear.text_size = 13 clear.font = "Cascadia Code" spacerc = Text(app, text="") # Spacer C calculate = PushButton(app, calcular, text="Calculate") # "Calculate" calculate.bg = "#565656" calculate.text_size = 13 calculate.font = "Cascadia Code" spacerd = Text(app, text="") # Spacer D functionlist = PushButton(app, flist, text="Function List") # Function List functionlist.bg = "#565656" functionlist.text_size = 11 functionlist.font = "Cascadia Code" # BG colors operacao.bg = "#565656" numinsert.bg = "#565656" # Drawing variable initialize drawingres = Drawing(app, width="fill", height="fill") # Display app.display()
color_label = Text(tool_box, text="color", align="top", width="fill") color_label.bg = "black" color_label.text_color = "white" red = Slider(tool_box, end=255, command=update_color) red.bg = (255, 0, 0) green = Slider(tool_box, end=255, command=update_color) green.bg = (0, 255, 0) blue = Slider(tool_box, end=255, command=update_color) blue.bg = (0, 0, 255) line_width_box = Box(tool_box, align="top") Text(line_width_box, text="width", align="top") line_width = Slider(line_width_box, start=1, end=10, align="top") painting = Drawing(paint_box, width="fill", height="fill") painting.last_event = None painting.last_shape = None painting.when_left_button_pressed = start_paint painting.when_mouse_dragged = draw_paint painting.when_left_button_released = stop_paint PushButton(tool_box, text="Clear", command=painting.clear, align="bottom", width="fill") a.display()
def test_oval(): a = App() d = Drawing(a) id = d.oval(1,2,3,4) assert id > 0 a.destroy()
def test_rectangle(): a = App() d = Drawing(a) id = d.rectangle(1,2,3,4) assert id > 0 a.destroy()
def test_auto_layout(): a = App() w = Drawing(a) auto_layout_test(w, None) a.destroy()
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
from guizero import App, Drawing import RPi.GPIO as GPIO import dht11, time, datetime # LCD 화면 크기 # $ fbset -s 명령어로 알아낼 수 있음. width = 800 height = 480 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)
def test_destroy(): a = App() d = Drawing(a) destroy_test(d) a.destroy()
80, bottom_text.value, color=color.value, size=size.value, font=font.value) # App app = App("Meme Generator") # widgets title = Text(app, "meme generator") top_text = TextBox(app, "top_text", command=draw_meme) bottom_text = TextBox(app, "bottom_text", command=draw_meme) font = Combo(app, options=["times new roman", "verdana", "courier", "impact"], command=draw_meme, selected="times new roman") color = Combo(app, options=["black", "white", "red", "green", "blue", "orange"], command=draw_meme, selected="blue") size = Slider(app, start=20, end=50, command=draw_meme) meme = Drawing(app, width="fill", height="fill") draw_meme() # button = PushButton(app, draw_meme, "Generator") # Display app.display()
def test_enable(): a = App() d = Drawing(a) enable_test(d) a.destroy()
def test_polygon(): a = App() d = Drawing(a) id = d.polygon(1,2,3,4,5,6,7,8) assert id > 0 a.destroy()
def test_cascaded_properties(): a = App() d = Drawing(a) cascaded_properties_test(a, d, False) a.destroy()
def test_triangle(): a = App() d = Drawing(a) id = d.triangle(1,2,3,4,5,6) assert id > 0 a.destroy()
def test_line(): a = App() d = Drawing(a) id = d.line(1,2,3,4) assert id > 0 a.destroy()
# ------------------------------ # Imports # ------------------------------ from guizero import App, Drawing # ------------------------------ # Functions # ------------------------------ def draw(event): painting.oval(event.x - 1, event.y - 1, event.x + 1, event.y + 1, color="black") # ------------------------------ # App # ------------------------------ app = App("Paint") painting = Drawing(app, width="fill", height="fill") painting.when_mouse_dragged = draw app.display()