-1

enter image description here

as you can see in the above images I am make two different screens in .kv files so suppose I have more screens and I don't want to make mess in the same .kv files so like is there a way we can write these aboutScreen and HomeScreen in different .kv file and than import it to one .kv file for code modularization.

I tried to directly import the files but seems it doesn't work like that ? enter image description here

2 Answers2

0

Here is an example:

kivy.uix.screenmanager.ScreenManagerException: ScreenManager accepts only Screen widget error

You can also split python code into separate py files as well, like screen1.kv and screen2.py. I'll give you and example if you are interested in.

MST
  • 651
  • 1
  • 4
  • 6
0

For my implementation of this I created a subfolder for my additional kv files in the working directory, so I account for the subfolder in the include.

In your main.kv use:

#: include kv/screen1.kv
#: include kv/screen2.kv

WindowManager:
    Screen1:
    Screen2:
BREP
  • 31
  • 8