def message(text):
windll.user32.MessageBoxW(0, text, 'Message', 0x20)
def otherfunc(startDistance, hops, i, formats, j):
text = str('Distance: ' + str((startDistance + (hops * i))) + '. Format: ' + formats[j])
threading.Thread(target=message, args=(text)).start()
由於某些原因,此代碼會產生函數獲取29個參數的錯誤,即使您可以清楚地看到文本是字符串。 任何人有一個想法如何解決? 此外,當調用消息()沒有線程時,它工作正常。問題是它需要它在一個線程中。TypeError:message()需要1個位置參數(給出29)
你知道'(文本)'和'text'是一樣嗎?這不是一個元組。爲此你需要'(文字,)'。 –