实现小板在线信息,支持主板程序V2.10及以上

This commit is contained in:
ranchuan
2023-12-29 18:10:31 +08:00
parent ff87d33675
commit e44d5716cb
7 changed files with 835 additions and 18 deletions

60
updata/runtask_win.py Normal file
View File

@@ -0,0 +1,60 @@
from math import *
import dearpygui.dearpygui as dpg
import dearpygui.demo as demo
dpg.create_context()
dpg.create_viewport(title='Custom Title', width=800, height=800)
# demo.show_demo()
sindatax = []
sindatay = []
cosdatay = []
for i in range(100):
sindatax.append(i/100)
sindatay.append(0.5 + 0.5*sin(50*i/100))
cosdatay.append(0.5 + 0.75*cos(50*i/100))
def _on_demo_close(sender, app_data, user_data):
dpg.delete_item(sender)
dpg.delete_item("__demo_texture_container")
dpg.delete_item("__demo_colormap_registry")
dpg.delete_item("__demo_hyperlinkTheme")
def show():
dpg.add_texture_registry(label="Demo Texture Container", tag="__demo_texture_container")
dpg.add_colormap_registry(label="Demo Colormap Registry", tag="__demo_colormap_registry")
with dpg.theme(tag="__demo_hyperlinkTheme"):
with dpg.theme_component(dpg.mvButton):
dpg.add_theme_color(dpg.mvThemeCol_Button, [0, 0, 0, 0])
dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, [0, 0, 0, 0])
dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, [29, 151, 236, 25])
dpg.add_theme_color(dpg.mvThemeCol_Text, [29, 151, 236])
def _log(sender, app_data, user_data):
print(f"sender: {sender}, \t app_data: {app_data}, \t user_data: {user_data}")
with dpg.window(label="Dear PyGui Demo", width=800, height=500, on_close=_on_demo_close, pos=(0, 0), tag="__demo_id"):
# create plot
dpg.add_text("Anti-aliasing can be enabled from the plot's context menu (see Help).", bullet=True)
with dpg.plot(label="Line Series", height=400, width=-1):
# optionally create legend
dpg.add_plot_legend()
# REQUIRED: create x and y axes
dpg.add_plot_axis(dpg.mvXAxis, label="x")
with dpg.plot_axis(dpg.mvYAxis, label="y"):
# series belong to a y axis
dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)")
dpg.add_line_series(sindatax, cosdatay, label="0.5 + 0.75 * cos(x)")
show()
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()