Skip to content Skip to sidebar Skip to footer

Kivy: Popup Can Have Only One Widget As Content

I am having an issue with using a popup in my .kv file. I understand that a popup can only have one widget as it's content, however if I am only passing a GridLayout as a child tha

Solution 1:

Yes, it should work as you say, your code is correct.

The problem is that the loading of the .kv file is duplicated. As your App subclass is called MainApp, main.kv is loaded automatically if it is in same directory (Doc: How to load kv). On the other hand, you explicitly upload the file using Builder.load_file ('main.kv').

You must remove the call to Builder or rename MainApp/main.kv.

If you delete the call to Builder.load_file you must create the ScreenManager instance once the .kv is loaded. You can do something like:

classMainApp (App):defbuild(self):
         sm = ScreenManager (transition = FadeTransition ())
         sm.add_widget (MenuScreen (name = 'menu'))
         sm.add_widget (SurveyScreen (name = 'survey'))
         return sm

Post a Comment for "Kivy: Popup Can Have Only One Widget As Content"