0
我需要從的TextInput發送文本與裝飾的功能我得到<__主要__。Root對象在0x9b61e880>,而不只是字符串或unicode字符串
#MyApp.kv
TextInput:
#some parameters
id: TextInp
Button:
#some parameters
on_press: root.myfunc(TextInp.text)
這個文本一切進展順利,直到它得到我的功能:
#main.py
def myDecorator(REQUEST):
def error_checker(*args):
try: REQUEST(*args)
except: #do something
return error_checker
@myDecorator
def myfunc(*args):
RESPONSE = args
#now RESPONSE == <__main__.Root object at 0x9b61e880>, or something like that
如何正確發送TextInp.text到RESPONSE?
如果你什麼'TextInp.text()'呢? –
root.myfunc(TextInp.text()) 類型錯誤: 'STR' 對象不是可調用 – Fogapod
沒關係,保持它作爲'TextInp.text'。如果你做了'RESPONSE = str(args)'? –