我想在计时器上显示不同的文本(每个40秒)目前,它的输出"一些文本",然后在第二秒后显示"新事物"。它完全跳过了" new1" - " new4",而只能更改为" new5"
太多代码:
# New code: Define global
windowText = 'some text'
def customDraw(hWindow):
global windowText
time.sleep(1.0)
windowText = 'Something new1'
windowText = 'Something new2'
windowText = 'Something new3'
windowText = 'Something new4'
windowText = 'Something new5'
win32gui.RedrawWindow(hWindow, None, None, win32con.RDW_INVALIDATE | win32con.RDW_ERASE)
我已经为此工作了几天。我将方法从使用" new1"…" new5"的远程文件更改为仅放入" windowText ="此方法似乎更有希望的是,该程序直接跳过了我想要在计时器上显示的文本。
def customDraw(timer_id, time):
global hWindow
global counter
global windowText
if counter > 2:
counter = 0
text = ["test 0", "test 1", "test 2"]
windowText = text[counter]
counter = counter + 1
win32gui.InvalidateRect(hWindow, None, True)