Linux系统(Ubuntu)
需要安装PIL
、pyudev
、threading
、ctypes
、time
、abc
pip install PIL
pip install pyudev
pip install threading
pip install ctypes
pip install time
pip install abc
使用时需要先定义一个DeviceManager
类对象(设备管理器类),再调用其中的 enumerate()
函数来遍历设备获得设备对象列表。
manner = DeviceManager();
streamdocks = manner.enumerate();
获取到设备对象列表以后,使设备时需要先调用open()
方法打开设备,再调用其它方法操作设备
for device in streamdocks:
# 打开设备
device.open()
# # 刷新显示屏
device.refresh()
# 开线程获取设备反馈
t1 = threading.Thread(target=device.whileread)
t1.start()
# 设置设备亮度0-100
device.set_brightness(100)
# 设置背景图片(传图片的地址)
device.set_touchscreen_image("1.jpg")
time.sleep(1)
# # 设置设备某个按键的图标
device.set_key_image("2.jpg",3)
time.sleep(1)
# 清空某个按键的图标
device.cleaerIcon(3)
time.sleep(1)
# # 清空所有按键的图标
device.clearAllIcon()
# # 刷新显示屏
device.refresh()
time.sleep(1)
# # 关闭设备
device.close()
time.sleep(1)