MDButton - ImportError
nunezjorgepy opened this issue · 4 comments
nunezjorgepy commented
Hi there! I'm starting to use kivyMD, but I have a problema with MDButton. The error is:
Traceback (most recent call last):
File "c:\Kivy.md\Myquizlet\intento.py", line 2, in <module>
from kivymd.uix.button import MDButton, MDButtonIcon, MDButtonText
ImportError: cannot import name 'MDButton' from 'kivymd.uix.button' (C:\Kivy.md\virt\Lib\site-packages\kivymd\uix\button\__init__.py). Did you mean: 'button'?
The code I use is the one in kivyMD page:
from kivymd.app import MDApp
from kivymd.uix.button import MDButton, MDButtonIcon, MDButtonText
from kivymd.uix.screen import MDScreen
class Example(MDApp):
def build(self):
self.theme_cls.primary_palette = "Green"
return (
MDScreen(
MDButton(
MDButtonIcon(
icon="plus",
),
MDButtonText(
text="Elevated",
),
style="elevated",
pos_hint={"center_x": 0.5, "center_y": 0.5},
),
md_bg_color=self.theme_cls.surfaceColor,
)
)
Example().run()
I searched on github, but I couldn't find this error. Any ideas?
nunezjorgepy commented
https://kivymd.readthedocs.io/en/latest/components/button/#api-break
I'm kind of new at this. What do I have to do?
HeaTTheatR commented
pip install https://github.com/kivymd/KivyMD/archive/master.zip
nunezjorgepy commented
pip install https://github.com/kivymd/KivyMD/archive/master.zip
Thanks! I can use the MDButton now.