本文整理汇总了Python中hud.Hud.updateHud方法的典型用法代码示例。如果您正苦于以下问题:Python Hud.updateHud方法的具体用法?Python Hud.updateHud怎么用?Python Hud.updateHud使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hud.Hud
的用法示例。
在下文中一共展示了Hud.updateHud方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from hud import Hud [as 别名]
# 或者: from hud.Hud import updateHud [as 别名]
def main():
hud = Hud()
# ser = serial.Serial(port = '/dev/ttyUSB0',
# baudrate = 9600,
# parity = serial.PARITY_NONE,
# stopbits = serial.STOPBITS_ONE,
# bytesize = serial.EIGHTBITS,
# timeout = 1)
logger = 0
kv = {}
stringKV = {}
firstPass = True
while True:
# wrapping this all in a try-catch should handle file-opening/-closing timeline nicely
# i.e. catch TclError(possibly tclError): close file
#
# var parsing and file writing will need to be wrapped in classes
sleep(0.5)
#kv = RT.randomKV()
#print kv
try:
#inLine = ser.readline()
inLine = RT.randomKVLine()
if inLine[0] == '@':
newKV = parseLineToKV(inLine)
newStringKV = parseLineToStringKV(inLine)
if firstPass:
keys = sorted(newStringKV.keys())
logger = Logger(keys)
firstPass = False
if newKV != kv:
kv = newKV
stringKV = newStringKV
hud.updateHud(kv)
hud.update_idletasks()
hud.update()
logger.logKV(stringKV)
print strfkv(stringKV)
except TclError: #possibly tclError
print "HUD was closed"
logger.close()
break
except err:
print err
break