Layouts in Kivy Using Kv lang
Hello there. In the previous post we made mention that we were to write the same code but this time around using the kivy language or KV Lang.
What is Kv lang
If you are familiar with web design, then you will know that styling of html pages is done using CSS. Kv lang can be considered as Kivy's own CSS. Thus to make things simple, Kv lang does styling while Python does the logic.Though Python is used for logic, the same thing can be done within kv. Enough of the talk, let's code the previous app but using Kv lang.Main File
from kivy.uix.boxlayout import BoxLayout class RootWidget(BoxLayout): def __init__(self,**kwargs): super(RootWidget,self).__init__(kwargs) class MainApp(App): def build(self): return RootWidget() MainApp().run()KV file main.kv
<RootWidget>: orientation:'vertical' Label: text:'Name' TextInput: id:name multiline:False Label: text:'Password' TextInput: id:password password:True multiline:False
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home