Делал, меню для входа на киви используя kv файл, выдаёт ошибку
Пайтон код:
Файл my.kv:
Ошибка:
Traceback (most recent call last):
File "/home/phonik/PycharmProjects/MyGimnazia/main.py", line 52, in <module>
MyApp().run()
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/app.py", line 954, in run
self._run_prepare()
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/app.py", line 923, in _run_prepare
self.load_kv(filename=self.kv_file)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/app.py", line 696, in load_kv
root = Builder.load_file(rfilename)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/builder.py", line 305, in load_file
return self.load_string(data, **kwargs)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/builder.py", line 372, in load_string
parser = Parser(content=string, filename=fn)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/parser.py", line 483, in __init__
self.parse(content)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/parser.py", line 593, in parse
objects, remaining_lines = self.parse_level(0, lines)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/parser.py", line 696, in parse_level
_objects, _lines = self.parse_level(
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/parser.py", line 666, in parse_level
raise ParserException(self, ln,
kivy.lang.parser.ParserException: Parser: File "/home/phonik/PycharmProjects/MyGimnazia/my.kv", line 2:
...
1:<Container>
>> 2: Login_Input: login
3: Password_Input: password
4:
...
Invalid data after declaration
Пайтон код:
Python:
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.properties import ObjectProperty
from kivy.config import Config
from kivy.core.window import Window
Window.size = (500, 400)
Window.clearcolor = (43 / 255, 43 / 255, 43 / 255)
Window.title = "Конвентер"
Config.set('graphics', 'resizeable', '0')
class Container(BoxLayout):
Verification_Login = False
Verification_Password = False
Login_Input = ObjectProperty()
Password_Input = ObjectProperty()
def Logining(self):
if self.Login_Input.text == "admin":
self.Verification_Login = True
if self.Password_Input.text == "admin":
self.Verification_Password = True
if self.Verification_Login and self.Verification_Password:
print("asd")
else:
print("c")
else:
print("b")
else:
print("a")
class MyApp(App):
# def __init__(self):
# super().__init__()
def build(self):
return Container()
if __name__ == "__main__":
MyApp().run()
Файл my.kv:
Python:
<Container>
Login_Input: login
Password_Input: password
AnchorLayout:
anchor_x: "center"
anchor_y: "center"
BoxLayout:
orientation: "vertical"
spacing: 1
size_hint: 0.6, 0.5
Label:
text: "Авторизация"
font_size: "43sp"
TextInput:
hint_text: "Логин"
size_hint: 1, 0.6
id: login
TextInput:
hint_text: "Пароль"
size_hint: 1, 0.6
id: password
Button:
text: "Войти"
size_hint: 1, 0.6
on_press: root.Logining()
Ошибка:
Traceback (most recent call last):
File "/home/phonik/PycharmProjects/MyGimnazia/main.py", line 52, in <module>
MyApp().run()
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/app.py", line 954, in run
self._run_prepare()
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/app.py", line 923, in _run_prepare
self.load_kv(filename=self.kv_file)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/app.py", line 696, in load_kv
root = Builder.load_file(rfilename)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/builder.py", line 305, in load_file
return self.load_string(data, **kwargs)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/builder.py", line 372, in load_string
parser = Parser(content=string, filename=fn)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/parser.py", line 483, in __init__
self.parse(content)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/parser.py", line 593, in parse
objects, remaining_lines = self.parse_level(0, lines)
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/parser.py", line 696, in parse_level
_objects, _lines = self.parse_level(
File "/home/phonik/PycharmProjects/MyGimnazia/venv/lib/python3.8/site-packages/kivy/lang/parser.py", line 666, in parse_level
raise ParserException(self, ln,
kivy.lang.parser.ParserException: Parser: File "/home/phonik/PycharmProjects/MyGimnazia/my.kv", line 2:
...
1:<Container>
>> 2: Login_Input: login
3: Password_Input: password
4:
...
Invalid data after declaration