That is a great question. Here are a few of my learnings. I hope others add their learnings as well.
The behavior at startup requires settings of screen size and position to be set prior to kivy.app being imported.
I put the Config.set() statements in a file I call configstartup.py and import this as the first file in main.py
I generally like to keep my python files and kv file separate. I use Pycharm and find the syntax coloring of the kv files helpful. I give the files the same stem name. I will often edit these files side by side in the editor. I load the kv file into it’s associated python file. I import the python file into main.py.
The exception to the guideline above is when I create custom widgets. They I often put the kv string inside the py file. I will also put test code in this kind of file under a if __name__ == “__main__”: clause.
I generally like to minimize the number of properties I put into App. The App location is very convenient because it is easy to access from kv and python. Use only when required.
The kv name space is global, and can be very powerful when redefining default behavior of widgets. Read the kivy.lang documentation repeatedly. https://kivy.org/doc/stable/api-kivy.lang.html?highlight=lang#module-kivy.lang
Here is one of my smaller projects: https://github.com/ElliotGarbus/ChaseBlissEditor
Circleknob.py is an example of a custom widget with embedded kv, and test code. I have used this code across a number of projects.
Look at the top of chaseblisseditor.kv notice that python code can be imported and called directly from kv. Notice how attributes are redefined using the ‘-‘. As in:
<CircleKnob>
-arc_background: [.3, .3, .3, 1]
-arc_foreground: white
-text_color: white
-font_size: fs
<Label>
-font_size: fs
<Button>
-font_size: fs
<Spinner>
-font_size: fs
These changes are global and effect the entire kv name space.
Kivy is a complex framework, and an associated learning curve. I find the documentation quite good.
Build small examples to learn, seek help when needed. Enjoy the journey!
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/746ad287-a519-4a31-8bb0-3f14f6dde812%40googlegroups.com.