#python #kivy
Вопрос:
Я пытаюсь обновить текст в своем приложении с помощью идентификатора, но, похоже, я вообще не обновляю текст. У меня есть файл на python myfirebase.py и файл kivy, подписанный на экране.kv:
Ошибки нет, но она явно не обновляет текст метки
Идентификатор метки-login_message, который я пытаюсь обновить, если в файле python неверно указано значение = true, но безуспешно
myfirebase.py:
«»»
import requests import json from kivy.app import App class MyFirebase(): def sign_in(self, username, password): result_users = requests.get("https://uniquedatabase-c4647- default-rtdb.firebaseio.com/" "users" ".json") data_users = json.loads(result_users.content.decode()) incorrect_info = True for users in data_users.values(): if username == users['username']: passcode = users['password'] if password == passcode: incorrect_info = False App.get_running_app().my_user_id = users App.get_running_app().change_screen ('home_screen') break if incorrect_info: App.get_running_app().root.ids['signin_screen'] .ids['login_message'].text = 'invalid username or password'
«»»
экран подписи.кв:
«»»
lt;SigninScreengt;: FloatLayout: GridLayout: rows: 1 pos_hint: {"top": 1, "right": 1} size_hint: 1, .2 Image: source: 'images/Uniquelogo.jpg' size: self.texture_size TextInput: id:login_username hint_text: "username" size_hint: .8,.1 pos_hint: {"top": .7, "right": .9} TextInput: id:login_password hint_text: "password" size_hint: .8,.1 pos_hint: {"top": .5, "right": .9} Label: id: login_message text: '' size_hint: .8,.1 pos_hint: {"top": .3, "right": .9} color: 1,0,0,1 Button: pos_hint: {"top": .2, "right": 0.75} size_hint: 0.5, 0.25 text: 'Sign In' color: 0,0,0,1 background_normal: '' background_color: 1,0.95,0,1 on_release: app.my_firebase.sign_in(login_username.text, login_password.text)
«»»