kivymd / KivyMD

KivyMD is a collection of Material Design compliant widgets for use with Kivy, a framework for cross-platform, touch-enabled graphical applications. https://youtube.com/c/KivyMD https://twitter.com/KivyMD https://habr.com/ru/users/kivymd https://stackoverflow.com/tags/kivymd
https://kivymd.readthedocs.io
MIT License
2.21k stars 663 forks source link

MDButton - ImportError #1698

Closed nunezjorgepy closed 4 months ago

nunezjorgepy commented 4 months ago

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?

HeaTTheatR commented 4 months ago

https://kivymd.readthedocs.io/en/latest/components/button/#api-break

nunezjorgepy commented 4 months ago

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 4 months ago

pip install https://github.com/kivymd/KivyMD/archive/master.zip

nunezjorgepy commented 4 months ago

pip install https://github.com/kivymd/KivyMD/archive/master.zip

Thanks! I can use the MDButton now.