python - Sense Hat - 检查时间操纵杆持有
问题描述
我对 python 并不陌生,但我不是 Sense Hat 的专业人士。
我想制作一个程序,如果我保持中间一段时间,就会发生一个动作。我知道我可以这样做:
if event.direction=="middle" and event.action=='held':
time.sleep(5)
if event.direction=="middle" and event.action=='held':
# do action here
但这会使程序休眠。有没有更好(更清洁)的方法来做到这一点?
解决方案
推荐阅读
- chapel - 我不明白对象初始化程序中的错误
- mysql - 如何在 SQL 中从 my_table WHERE some_other_column = "something" 中选择 MAX(column) 作为 max_value
- c++ - 我将一个类型库 ( .tlb ) 导入到 Delphi 中,并且函数参数似乎不正确。我应该如何解决它?
- java - 如何通过 webview 上传多个文件?
- fusionauth - 如何在nodejs客户端中使用queryString进行fusionauth?
- c# - 如何让任务等待相同的结果?
- asp.net-core - 在一个 Model DDD .NET Core 中映射两个聚合
- cloud-foundry - 如何在没有 Pivotal Cloud Foundry 的情况下使用 Steeltoe
- apache-flex - 如何导入 flex iframe 组件?
- php - Ninja Forms:在 PDF 提交中显示复选框列表和文件上传值