User Tools

Site Tools


wiki:fixed_btn_size

Fixed button size in GridLayout

fixed_btn_gl.py
from kivy.app import App
from kivy.uix.screenmanager import Screen
 
from kivy.lang import Builder
 
gui = '''
LoginScreen:
 
    GridLayout:
        cols: 2
 
        Label:
            text: 'Subject'
 
        Label:
 
        Label:
            text: '1'
 
        SingleLineTextInput:
 
        Label:
            text: '2'
 
        SingleLineTextInput:
 
        Label:
            text: '3'
 
        SingleLineTextInput:
 
        Label:
            text: '4'
 
        SingleLineTextInput:
 
        GreenButton:
            text: 'Exit'
            on_press: app.stop()
 
        GreenButton:
            text: 'Run'
 
 
<SingleLineTextInput@TextInput>:
    multiline: False
 
 
<GreenButton@Button>:
    background_color: 0, 1, 0, 1
    size_hint_y: None
    height: self.parent.height * 0.111
'''
 
 
class LoginScreen(Screen):
    pass
 
 
class SimpleKivy(App):
 
    def build(self):
        return Builder.load_string(gui)
 
 
if __name__ == '__main__':
    SimpleKivy().run()
wiki/fixed_btn_size.txt · Last modified: 2020/12/10 16:48 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki