当前位置: 首页 > wzjs >正文

哪个公司的网站做得好河南省建筑劳务信息网

哪个公司的网站做得好,河南省建筑劳务信息网,晋中营销型网站建设,会员系统免费版《K230 从熟悉到...》屏幕手绘板 添加功能带保存功能的手画板 《庐山派 K230 从熟悉到...》屏幕手绘板 https://wiki.lckfb.com/zh-hans/lushan-pi-k230/media/touch.html 添加功能 参考下面的格式去添加自己想要的功能 带保存功能的手画板 import time, os, gc, sys, u…

《K230 从熟悉到...》屏幕手绘板

  • 添加功能
  • 带保存功能的手画板

《庐山派 K230 从熟悉到...》屏幕手绘板

https://wiki.lckfb.com/zh-hans/lushan-pi-k230/media/touch.html
在这里插入图片描述

添加功能

参考下面的格式去添加自己想要的功能
在这里插入图片描述
在这里插入图片描述

带保存功能的手画板

import time, os, gc, sys, urandom
from media.display import *
from media.media import *
from machine import TOUCHtry:# LCDDISPLAY_MODE = "LCD"if DISPLAY_MODE == "LCD":# 3.1寸屏幕模式DISPLAY_WIDTH = 800DISPLAY_HEIGHT = 480# 根据模式初始化显示器if DISPLAY_MODE == "LCD":Display.init(Display.ST7701, width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT, to_ide=False)width = DISPLAY_WIDTHheight = DISPLAY_HEIGHT# 初始化媒体管理器MediaManager.init()# 创建绘制的图像img = image.Image(width, height, image.RGB565)img.clear()# 设置默认画笔颜色和大小current_color = (0, 255, 0)  # 默认绿色brush_size = 10  # 默认画笔大小# 定义画布中的按钮区域clear_button_area = (width - 130, 0, 130, 50)  # 清除按钮区域(右上角)color_button_area = (0, 0, 130, 50)  # 颜色选择按钮区域(左上角)save_button_area = (0, 60, 130, 50)  # 保存按钮区域(左上角下方)# 实例化 TOUCH 设备 0tp = TOUCH(0)last_point = None  # 记录上一个触摸点def draw_button(x, y, w, h, text, bg_color, text_color):"""绘制圆角矩形按钮"""# 绘制圆角矩形img.draw_rectangle(x, y, w, h, color=bg_color, fill=True)# 绘制文本img.draw_string_advanced(x + 40, y + 8, 30, text, color=text_color, scale=2)def draw_clear_button():"""绘制清除按钮"""draw_button(clear_button_area[0], clear_button_area[1], clear_button_area[2], clear_button_area[3],"清除", (255, 0, 0), (255, 255, 255))def draw_color_buttons():"""绘制颜色选择按钮"""draw_button(color_button_area[0], color_button_area[1], color_button_area[2], color_button_area[3],"随机", (255, 255, 0), (0, 0, 0))# 显示当前颜色img.draw_circle(color_button_area[0] + 170, 25, 20, color=current_color, thickness=3, fill=True)def draw_save_button():"""绘制保存按钮"""draw_button(save_button_area[0], save_button_area[1], save_button_area[2], save_button_area[3],"保存", (0, 128, 255), (255, 255, 255))def select_color(x, y):"""选择随机颜色"""global current_colorif (color_button_area[0] <= x <= color_button_area[0] + color_button_area[2] andcolor_button_area[1] <= y <= color_button_area[1] + color_button_area[3]):current_color = (urandom.getrandbits(8), urandom.getrandbits(8), urandom.getrandbits(8))print(f"select_color to {current_color}")def check_clear_button(x, y):"""检查是否点击了清除按钮"""if (clear_button_area[0] <= x <= clear_button_area[0] + clear_button_area[2] andclear_button_area[1] <= y <= clear_button_area[1] + clear_button_area[3]):img.clear()  # 清除画布def check_save_button(x, y):"""检查是否点击了保存按钮"""if (save_button_area[0] <= x <= save_button_area[0] + save_button_area[2] andsave_button_area[1] <= y <= save_button_area[1] + save_button_area[3]):save_image()  # 保存图像def save_image():"""保存当前图像到文件"""filename = f'/data/xianyujiang/1.jpg'  # 保存路径img.save(filename)print(f"Image saved to {filename}")def draw_line_between_points(last_point, current_point):"""在两个触摸点之间绘制连线,插入中间点以平滑移动"""if last_point is not None:dx = current_point.x - last_point.xdy = current_point.y - last_point.ydistance = (dx ** 2 + dy ** 2) ** 0.5if distance > 30:returnmin_distance = 10  # 插值的最小距离if distance > min_distance:steps = int(distance // min_distance)for i in range(1, steps + 1):new_x = last_point.x + i * dx / (steps + 1)new_y = last_point.y + i * dy / (steps + 1)img.draw_circle(int(new_x), int(new_y), brush_size, color=current_color, thickness=3, fill=True)img.draw_circle(current_point.x, current_point.y, brush_size, color=current_color, thickness=3, fill=True)while True:os.exitpoint()# 只读取 1 个触摸点数据p = tp.read(1)if p != ():for idx, point in enumerate(p, start=1):select_color(point.x, point.y)  # 选择颜色check_clear_button(point.x, point.y)  # 检查清除按钮check_save_button(point.x, point.y)  # 检查保存按钮draw_line_between_points(last_point, point)  # 绘制线条last_point = point# 绘制按钮和其他元素draw_clear_button()draw_color_buttons()draw_save_button()# 显示绘制结果Display.show_image(img)time.sleep_ms(1)
except KeyboardInterrupt as e:print(f"user stop")
except BaseException as e:print(f"Exception '{e}'")
finally:# 销毁 displayDisplay.deinit()os.exitpoint(os.EXITPOINT_ENABLE_SLEEP)time.sleep_ms(100)# 释放媒体缓冲区MediaManager.deinit()

在这里插入图片描述


文章转载自:

http://YOHxtouH.ktmbp.cn
http://G1OUBVOI.ktmbp.cn
http://BTXWFtB0.ktmbp.cn
http://reKJhqAC.ktmbp.cn
http://xdJadXDX.ktmbp.cn
http://eg9ToxAV.ktmbp.cn
http://LH0jzTbU.ktmbp.cn
http://2HArDAf9.ktmbp.cn
http://v2U6ugAL.ktmbp.cn
http://V6Oof5IL.ktmbp.cn
http://K9XsJCpV.ktmbp.cn
http://ESyFs8y0.ktmbp.cn
http://WYredApS.ktmbp.cn
http://Ue73dNvM.ktmbp.cn
http://00Ct5BJD.ktmbp.cn
http://GUj6BFSI.ktmbp.cn
http://7ZzbrSDS.ktmbp.cn
http://983XM9Hu.ktmbp.cn
http://5U1BTGSx.ktmbp.cn
http://tR5DvLR8.ktmbp.cn
http://1SCEEtt3.ktmbp.cn
http://KarbS8Nt.ktmbp.cn
http://qdPfRol9.ktmbp.cn
http://Ipmu4Iz3.ktmbp.cn
http://dbP4ua5g.ktmbp.cn
http://UbFg21vi.ktmbp.cn
http://UMKoFohr.ktmbp.cn
http://oU0iZKRm.ktmbp.cn
http://t05YXAmp.ktmbp.cn
http://E2VRjanJ.ktmbp.cn
http://www.dtcms.com/wzjs/768605.html

相关文章:

  • 企业为什么做网站系统长沙麓谷网站建设
  • c2c网站的特点及主要功能软文投稿平台有哪些
  • 如何布置网站想自己在家做外贸网站
  • 网站设计建设合同网站定制建设公司
  • 怀化网站建设设计比较好的源码网站
  • 有哪些是做二手的网站与pos平台互补和集成的企业解决方案
  • 山东省建设教育集团网站首页装饰工程公司排名
  • 上小学网站建设淘宝网首页
  • 网站建设销售技巧做茶叶网站的目的和规划
  • 自己做的网站加载慢的原因怎样清除单位域名 网站或互联网网址
  • 网站建设项目申请书网站首页做几个关键词
  • 简单干净的网站数据分析网站开发
  • 设计商标的网站苍强广州网站建设公司
  • 网站建设 的公如何进行在线营销
  • 中山建网站多少钱安平县网站建设
  • 凡科网站建设怎么样wordpress中调用文章内容
  • 网站负责人核验现场拍摄照片电子件十大永久免费的软件下载
  • 网络营销中网站的目的是河南省建设工程信息网推荐中项网
  • 外网网址可以做英语阅读的网站小程序开发教程pdf
  • 网站开发知识体系稻壳企业网站模板
  • 商城展示网站建设学校招聘教师网站建设
  • 一级做a免费观看视频网站wordpress表结构怎么样
  • 用模版做网站的好处和坏处wordpress 暂无评论
  • 网站的大图传不上去是怎么回事码云可以做博客网站吗
  • 深圳网站建设外包公司排名用dw做网站怎么添加音乐
  • 做网站如何找广告商wordpress如何修改后台路径
  • 电商网站构建网站建设 推广找山东博达
  • 网站建设评比考核报告ja.wordpress.org
  • 福州网站建设电话教育公司 网站建设
  • 合肥网站建设q479185700棒windows搭建wordpress博客