Ошибка MDNavigation Drawer (AttributeError: модуль 'kivy.core.window' не имеет атрибута 'width')
Я пытаюсь реализовать MDNavigation Drawer в моем главном окне. он работал раньше, но я попытался поместить его под макет навигации из-за того, что он оставил пятно на моей главной странице, но теперь то, что раньше работало, больше не работает, и все, что я пытаюсь, выдает мне эту ошибку. Буду признателен за помощь. Спасибо. Ниже трассировка и мой код. Заранее спасибо.
Код
<MainWindow>
canvas.before:
Color:
rgba: 0, 0, 0, 1
Rectangle:
pos: self.pos
size: self.size
NavigationLayout:
MDNavigationDrawer:
id: thenavigation
ScrollView:
MDList
NavigationItemTwo:
id: identifyitem
NavigationImage:
NavigationItem:
text: "Profile"
on_release:
app.root.current = "page"
root.manager.transition.direction = "up"
NavigationItem:
text: "Schedule"
on_release:
app.root.current = "schedule"
root.manager.transition.direction = "up"
NavigationItem:
id: themessage
text: "Messages"
on_release:
app.root.current = "messages"
root.manager.transition.direction = "up"
NavigationItem
id: thenotification
text: "Notifications"
on_release:
app.root.current = "notif"
root.manager.transition.direction = "up"
NavigationItem
text: "Projects Posted"
on_release:
app.root.current = "projectsposted"
root.manager.transition.direction = "up"
NavigationItem:
text: "Projects done by you"
on_release:
app.root.current = "byyou"
root.manager.transition.direction = "up"
NavigationItem
text: "Projects done by others"
on_release:
app.root.current = "byothers"
root.manager.transition.direction = "up"
NavigationItem
text: "Search Freelancers"
on_release:
app.root.current = "searchfreelancers"
root.manager.transition.direction = "up"
NavigationItem
text: "Log Out"
theme_text_color: "Custom"
text_color: (1, 0, 0, 1)
on_release:
root.loggedout()
Выслеживать
Traceback (most recent call last):
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 249, in create_handler
return eval(value, idmap), bound_list
File "<string>", line 7, in <module>
AttributeError: module 'kivy.core.window' has no attribute 'width'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 615, in _apply_rule
rctx['ids'])
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 254, in create_handler
cause=tb)
kivy.lang.builder.BuilderException: Parser: File "<inline>", line 7:
...
5:<MDNavigationDrawer>:
6: size_hint_x: None
>> 7: width: Window.width - dp(56) if Window.width <= dp(376) else dp(320)
8: x:
9: (self.width * (self.open_progress - 1)) if self.anchor == "left" else (Window.width - self.width * self.open_progress)
...
AttributeError: module 'kivy.core.window' has no attribute 'width'
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 249, in create_handler
return eval(value, idmap), bound_list
File "<string>", line 7, in <module>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/temitayoadefemi/PycharmProjects/Merri Inc/mainfile.py", line 6224, in <module>
MyApp().run()
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/app.py", line 800, in run
root = self.build()
File "/Users/temitayoadefemi/PycharmProjects/Merri Inc/mainfile.py", line 6218, in build
sm = Builder.load_file("kivy.kv")
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 301, in load_file
return self.load_string(data, **kwargs)
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 400, in load_string
self._apply_rule(widget, parser.root, parser.root)
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 584, in _apply_rule
self.apply(child)
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 469, in apply
self._apply_rule(widget, rule, rule, ignored_consts=ignored_consts)
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 585, in _apply_rule
self._apply_rule(child, crule, rootrule)
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 584, in _apply_rule
self.apply(child)
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 469, in apply
self._apply_rule(widget, rule, rule, ignored_consts=ignored_consts)
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 630, in _apply_rule
e), cause=tb)
kivy.lang.builder.BuilderException: Parser: File "<inline>", line 7:
...
5:<MDNavigationDrawer>:
6: size_hint_x: None
>> 7: width: Window.width - dp(56) if Window.width <= dp(376) else dp(320)
8: x:
9: (self.width * (self.open_progress - 1)) if self.anchor == "left" else (Window.width - self.width * self.open_progress)
...
BuilderException: Parser: File "<inline>", line 7:
...
5:<MDNavigationDrawer>:
6: size_hint_x: None
>> 7: width: Window.width - dp(56) if Window.width <= dp(376) else dp(320)
8: x:
9: (self.width * (self.open_progress - 1)) if self.anchor == "left" else (Window.width - self.width * self.open_progress)
...
AttributeError: module 'kivy.core.window' has no attribute 'width'
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 249, in create_handler
return eval(value, idmap), bound_list
File "<string>", line 7, in <module>
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 615, in _apply_rule
rctx['ids'])
File "/Users/temitayoadefemi/untitled6/lib/python3.7/site-packages/kivy/lang/builder.py", line 254, in create_handler
cause=tb)
Process finished with exit code 1