kv file in application directory loaded automatically by app().run()

219 views
Skip to first unread message

Piet Stevens

unread,
Jun 17, 2017, 4:46:55 AM6/17/17
to Kivy users support
Running kivy 1.9.2-dev0, python 3.5.2.

I receive a message that my kv file is loaded multiple times. I load it in the build method of my app, as recommended by the tutorial. However, app().run() also loads any file with kv extension in the app directory (app.py line 598).

How to avoid such double loading? Can I just leave the build method empty?

Andreas Ecker

unread,
Jun 17, 2017, 11:05:45 AM6/17/17
to kivy-...@googlegroups.com
Without providing any code snippets I can only assume that your code is explicitly loading the kv file which is not needed when your kivy file name is identic to your app class name (in lowercase and without the App suffix).

The comment on top of the load_kv() method - you are referring to (with app.py line 598) - is explaining this automatic functionality more detailed.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Piet Stevens

unread,
Jun 17, 2017, 11:20:44 AM6/17/17
to Kivy users support
Thank you for your reply.

I did load explicitly inside the build method of the app:          root_widget = Builder.load_file('one.kv')

Looking at the comments, maybe that  is too late. I then moved that statement to earlier in my main.py, but I still get a warning that my kv file is loaded twice. I manually provide the name of the .kv file as my application would not read a file in lowercase without App.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

Andreas Ecker

unread,
Jun 17, 2017, 12:43:26 PM6/17/17
to kivy-...@googlegroups.com
Still confused ...

Assuming you named your kivy app class OneApp - in this case you can remove the call to Builder.load_file().

Next time please provide a code snippet of your kivy app class....


To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages