几天前,代码完美运行。今天,尝试启动程序时出现TypeError。
TypeError: 'AnchorLayout' object is not callable kivy python
怎么了?
class MyApp(App):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.password = TextInput(text='', password=True, multiline=False, size_hint_y=None) # Обьявление пароля
self.username = TextInput(text='', multiline=False, size_hint_y=None) # Обьявление логина
@property
def build(self):
al: AnchorLayout = AnchorLayout(anchor_x='center',anchor_y='center')
al.add_widget(Label(text='Login'))
al.add_widget(self.username)
al.add_widget(Label(text='Password'))
al.add_widget(self.password)
al.add_widget(Button(text='Войти', on_press=self.login))
return al
def login(self, instance):
username = print(self.username.text)
password = print(self.password.text)
s = cursor.execute("SELECT password FROM drivers WHERE username='"+str(username)+"'")
for x in cursor:
print(x)
if password == s:
print('Success')