用于生成人机界面的python库
hm的Python项目详细描述
目的
hmpy是一个用于构建hmi的python库。
安装hmpy
要使用pip安装最新版本的hmpy,请执行以下操作:
$ pip install hmPy
运行测试
hmpy的测试套件可以使用tox:
$ tox
请注意,PEP8合规性要求测试通过。
示例代码
对于那些想一帆风顺的人:
from hmpy import Interface from hmpy.views import ButtonView, LCDView # Create the base interface hmi = Interface() # Initialize counter to 0 count = 0 # Initialize an LCD View and a button View lcd = LCDView() btn = ButtonView("Increment") def increment_count(): lcd.value += 1 # Call the increment count method whenever the button is pressed btn.on_press(increment_count) # Add the views to the interface hmi.add_view(lcd) hmi.add_view(btn) # Launch the interface hmi.start()
有关更详细的文档和高级示例,请参阅完整的文档。
文档
完整的文档和教程可在Read the Docs找到。