Learn to develop universally compatible apps using Python and Kivy!! This is episode 8 in an intro to Kivy series from LeMaster Tech. This episode covers loading in a design file separate from the default kivy design .kv file! The Builder module of kivy allows you to specify multiple design files without changing the name of your app!
If you want to see anything specific on the channel or have technical questions about anything leave a comment on our of our videos and we will get back as soon as we can!
Thanks for watching and supporting the channel!
hey welcome back to the channel
everybody um today's episode is going to
be a continuation in our kivi for python
app building series and i've got a nice
short one for you here it's just kind of
a
good thing you should know so in the
last video we introduced the kivi design
language and exporting kind of the style
element of your app into a separate file
similar to web development with html and
css
so we have this app
and i know we talked about when you
create the kv file you should make it
the name of your app
minus the word app
and then dot kv and then
kivi will just know where to look for it
so today i'm just gonna say um
i'm gonna show you quickly how to use uh
the builder so that um you can specify a
file and it doesn't necessarily have to
be
named like that so let's say that you
have a huge app that's got like 50
different screens in it and you want to
design those screens one at a time
so let's call this something else let's
say uh
this is different app okay and then down
here we're
we're running
different app um well maybe you know we
don't have one single screen we have
like screen one screen two screen three
um so we don't necessarily want uh
to just have to make it called call it
different.kv
and you can see there's nothing on the
screen now because it's not called
different.kb
so if i run this
there's nothing
there's a way to actually load a
specific file using the builder so what
we're going to
um is we are going to import
the
builder uh which is going to be from
kivy
from kibby and this will be dot lang
[Music]
and then import
builder
first letter capitalized
builder and then
we are going to use the builder right on
the next
right on the next line it's builder dot
load file
um and then if it's in your directory
like we ours is login.kv and it's in
this directory um
then you can just do it without defining
a file path but if you have it stored in
like
c users documents uh kivy design files
whatever sometimes you'll have to
specify the folder
if you have a bunch of them and you're
grouping them all together in a folder
you might have to say you know ki design
files slash login
um
but so now we should be loading in the
qivi file from before and if let's go
ahead and run this now and see if that's
working yep so if you design like
multiple different interfaces
and you want to be able to switch
between them that's when you would call
the builder
so that's
that's kind of a good thing to know i'll
probably keep the builder in here for
future videos but as long as you're
working on one screen there's no reason
you can't um just
make the name of your app uh also
the name of your kivi file so the
builder is a nice thing it it's how
you'll load files even if um even if
like you want to put images or things on
the screen which we'll take a look at
later
using the builder is super useful so i
definitely want to introduce that tool
and then one other thing we didn't talk
about in the previous video just because
that was kind of a longer video
now that all of the um widgets that
we're creating are being uh specified
inside of our design kivi file we can
actually go ahead and
we don't need these anymore you see
they're already grayed out we can get
rid of all that
we also could get rid of the import kibi
but i like keeping it there
but we don't need to import button label
text input grid layout any of that
specifically because the kibi design
file calls it out um so i cleared that
out and
yep we still get everything so
that's just an a useful quick
introduction to the kivi builder
function i'm not going to chew up too
much time on this video that's a nice
little
intro to a useful tool so hopefully you
found that useful if you have any
questions about why using that or how to
use that go ahead and let me know about
in the comments below if you found this
or anything else on the channel useful i
really appreciate a liking and subscribe
it helps the channel out a ton and as
always good luck with your code and
thanks for watching thanks bye