一个简单易用的软件包,利用多功能显示器上的油门的X52和X52专业。
x52的Python项目详细描述
X52型
一个易于使用的软件包,利用了X52和X52 Pro的节流阀上的MFD,具有显示文本、浏览内容页面和回调等功能。在
包可在PyPi上找到
使用示例
fromsysimportexit# import necessary items from the x52 packagefromx52importX52,X52Page# Setup callback functions for later usedefcallback_func_1():print('hello from callback_func_1')defcallback_func_2():print('hello from callback_func_2')defcallback_func_3():print('hello from callback_func_3')# instantiate an X52 Object and initialize it# if the X52 Object gets garbage collected it gets# deinitializedx52=X52()x52.init()x52Devices=x52.get_x52devices()# Exit if there is no X52 connectedifnotx52Devices:exit(-1)# Select the first detected devicex52Device=x52Devices[0]# Create pages using the X52Page Constructorpage1=X52Page(('This is Item1',callback_func_1),('This is Item2',callback_func_2),('This is Item3',callback_func_3),True)page2=X52Page(('This is a non',None),('non interactive',None),('Page, with cycling text',None),False)# Add pages to the MFDx52Device.page_add(page1)x52Device.page_add(page2)# Endless loop, else program exitswhileTrue:pass
- 项目
标签: