【发布时间】:2016-01-15 13:12:03
【问题描述】:
我在玩 Kivy 并构建了一些按钮:
for i in range(30):
self.user = str(i)
self.btn = Button(text=self.user, size_hint_y=None, height=40)
self.btn.bind(on_press=self.auth(self.user))
self.layout.add_widget(self.btn)
这些按钮调用身份验证:
def auth(mytext,instance):
print "auth called"
popup = Popup(title="success",
content=Label(text=mytext),
size=(100, 100),
size_hint=(0.3, 0.3),
auto_dismiss=False)
popup.open()
为什么我没有将包含字符串的 self.user 传递给 auth 函数 mytext 变量?
我收到了AssertionError: None is not callable。
【问题讨论】:
标签: python function class kivy