2686| 0
|
行空板触摸屏(1) |
画板 # -*- coding: UTF-8 -*- # MindPlus # Python from pinpong.extension.unihiker import * from pinpong.board import Board,Pin from unihiker import GUI # 事件回调函数 def button_click1(): buzzer.play(buzzer.ENTERTAINER,buzzer.ForeverInBackground) def button_click2(): buzzer.stop() def button_click3(): a=u_gui.draw_emoji(emoji="Angry",x=0,y=0,duration=0.2) def mouse_move(x,y): global my_variable global aaa global bbb if (my_variable == 0): a=u_gui.draw_rect(x=x,y=y,w=1,h=1,width=1,color="#0000FF") aaa = x bbb = y my_variable = 1 else: a=u_gui.draw_line(x0=aaa,y0=bbb,x1=x,y1=y,width=1,color="#0000FF") aaa = x bbb = y def on_buttona_click_callback(): u_gui.fill_rect(x=0,y=0,w=240,h=240,color="#FFFFFF") a=u_gui.draw_line(x0=0,y0=240,x1=240,y1=240,width=2,color="#000000") def on_buttonb_click_callback(): print(requests.post("http://713b2462d056429b93195bfb0accf468-cn-shanghai.alicloudapi.com", data={'node_8dd82d30': 0,'aaa':1})) u_gui=GUI() Board().begin() u_gui.on_mouse_move(mouse_move) u_gui.on_a_click(on_buttona_click_callback) u_gui.on_b_click(on_buttonb_click_callback) import requests my_variable = 0 aaa = 0 bbb = 0 a=u_gui.draw_line(x0=0,y0=240,x1=240,y1=240,width=2,color="#000000") a=u_gui.add_button(text="开始",x=100,y=250,w=40,h=30,onclick=button_click1) a=u_gui.add_button(text="停止",x=150,y=250,w=40,h=30,onclick=button_click2) a=u_gui.add_button(text="不要按",x=55,y=250,w=40,h=30,onclick=button_click3) buzzer.stop() while True: pass cache-file.py.rar |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed