ImportError: cannot import name 'MDFlatButton' from 'kivymd.uix.button'

178 Views Asked by At

This is the code I was working in:

from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.dialog import MDDialog
from kivymd.uix.button import MDFlatButton
from kivy.core.window import Window

Window.size = (300, 450)

KV = '''
Screen:
    # More styling here
        MDFillFlatButton:
            text : "LOG IN"
            font_size: 15
            pos_hint: {"center_x" : 0.5}
            on_press: app.login() 
'''

ImportError: cannot import name 'MDFlatButton' from 'kivymd.uix.button' I was looking for something that could solve it; I re installed kivymd and updated Kivy to the lalest version but the mistake stills there :c

1

There are 1 best solutions below

0
user4573433 On BEST ANSWER

MDFlatButton is from kivymd 1.2.0 version.

If you have installed the lattest version of kivymd, 2.0.1.dev() you have to use this buttons:

from kivymd.uix.button import MDButton, MDButtonText

You have some examples on the doc:
https://kivymd.readthedocs.io/en/latest/getting-started/