Understanding two erros in the component MDFloatingActionButton
I'm studying kivymd and I came across 2 problems.
In the code below:
from kivy.app import App
from kivy.lang import Builder
from kivymd.theming import ThemeManager
from kivymd.time_picker import MDTimePicker
main_widget_kv = "MDFloatingActionButton:"
class KitchenSink(App):
theme_cls = ThemeManager()
def build(self):
main_widget = Builder.load_string(main_widget_kv)
return main_widget
if __name__ == '__main__':
KitchenSink().run()
- Is it always necessary to use this
theme_cls = ThemeManager()
?
If you do not enter theme_cls = ThemeManager()
the following error appears:
Traceback (most recent call last):
File "fab.py", line 14, in <module>
KitchenSink().run()
File "C:\Python\Python36-32\lib\site-packages\kivy\app.py", line 802, in run
root = self.build()
File "fab.py", line 10, in build
main_widget = Builder.load_string(main_widget_kv)
File "C:\Python\Python36-32\lib\site-packages\kivy\lang\builder.py", line 381, in load_string
widget = Factory.get(parser.root.name)()
File "C:\Python\Python36-32\lib\site-packages\kivymd\elevationbehavior.py", line 139, in __init__
self._shadow = App.get_running_app().theme_cls.round_shadow
AttributeError: 'KitchenSink' object has no attribute 'theme_cls'
- I do not understand why I need the MDTimePicker class being that I'm not using, at least explicitly.
If I remove the line from kivymd.time_picker import MDTimePicker
the following error appears:
Traceback (most recent call last):
File "fab.py", line 15, in <module>
KitchenSink().run()
File "C:\Python\Python36-32\lib\site-packages\kivy\app.py", line 802, in run
root = self.build()
File "fab.py", line 11, in build
main_widget = Builder.load_string(main_widget_kv)
File "C:\Python\Python36-32\lib\site-packages\kivy\lang\builder.py", line 381, in load_string
widget = Factory.get(parser.root.name)()
File "C:\Python\Python36-32\lib\site-packages\kivy\factory.py", line 131, in __getattr__
raise FactoryException('Unknown class <%s>' % name)
kivy.factory.FactoryException: Unknown class <MDFloatingActionButton>
By what I understand to use the MDFloatingActionButton
component need to import the MDTimePicker
class?
Thank you