Home > Net >  KivyMD cannot find reference "FocusBehavior"
KivyMD cannot find reference "FocusBehavior"

Time:10-12

I was curious what is focus behavior and visited the official page (KivyMD) and took the first example. Then I found out that FocusBehavior can't be imported. PyCharm recommended me to create class 'Focus Behavior' in 'init.py' but it doesn't seem to be the solution. I have already reinstalled kivy and kivymd, but still, it cannot find a reference 'FocusBehavior'. What should I do?

from kivymd.uix.behaviors import RectangularElevationBehavior, FocusBehavior ImportError: cannot import name 'FocusBehavior' from 'kivymd.uix.behaviors' (C:\Users\Kadel\AppData\Local\Programs\Python\Python39\lib\site-packages\kivymd\uix\behaviors_init_.py)

CodePudding user response:

The example is wrong. Try using this import:

from kivymd.uix.behaviors.focus_behavior import FocusBehavior
  • Related