Python-Kivy app - popup keyboard covers input fields

Viewed 59

Within my kivy app, I have a screen that contains several text input fields. I am using gridlayout. When I click on an input field in the lower half of the screen the popup keyboard covers the field making it difficult to see what is being entered. I have looked at scrollview for that screen but still having problems. ------------ kv file. Start of kv file':'

<FourthWindow>:
    name: "fourth"
       

    GridLayout:
        orientation: "vertical"
        cols: 2
        padding: 10
        spacing: 10
       

        Label:
            text: "Title"
        
            width:120
            height: 50
            font_size: 32
            background_color: (0.0/255, 0.0/255, 230.0/255, 1)
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
            
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
        
        Button:
            text: "Main"
            font_size: 32
            background_normal: ''
            background_color: utils.get_color_from_hex('#34a1eb')
            width: 240
            height: 90
            on_release: 
                app.root.current = "first"
                root.manager.transition.direction = "right"     
        Label:
            text: "Label 1"
            width:70
            height: 30
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
    
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: spid
            multiline:False
            width:70
            height: 50
            font_size: 24
        
        Label:
            text: "Label 2"
            width:70
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
        
        TextInput:
            id: spfhgt
            multiline:False
            width: 70
            height: 50
            font_size: 24
            
        Label:
            text: "Label 3"
            
            width:70
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
        
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: sptrv
            multiline:False
            
            width:70
            height: 50
            font_size: 24
            
        Label:
            text: "Label 4"
            
            width:50
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
        
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: sptrv
            multiline:False
        
            width:70
            height: 50
            font_size: 24
        
        Label:
            text: "Label 5"
            
            width:70
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
        
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: spwgt
            multiline:False
            
            width:70
            height: 50
            font_size: 24
        
        Label:
            text: "Label 6"
            
            width:70
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
            
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: spod
            multiline:False
            
            width:270
            height: 50
            font_size: 24
        
        Label:
            text: "Label 7 "
            
            width:270
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: spsrr
            multiline:False
            
            width:270
            height: 50
            font_size: 24
        
        Label:
            text: "Label 8 "
            
            width:70
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
        
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: spsrgs
            multiline:False
            
            width:70
            height: 50
            font_size: 24
        
        Label:
            text: "Label 9 "
            
            width:70
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
        
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: spmat
            multiline:False
            
            width:70
            height: 50
            font_size: 24
        
        Label:
            text: "Label 10"
            
            width:70
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
    
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: spseta
            multiline:False
            
            width:270
            height: 50
            font_size: 24
        
        Label:
            text: "Label 11"
            
            width:270
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
        
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: spsetb
            multiline:False
            
            width:270
            height: 50
            font_size: 24
            
        Label:
            text: "Label 12"
            
            width:270
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
        
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: sprubsz
            multiline:False
            
            width:270
            height: 50
            font_size: 24
        
        Label:
            text: "Label 13 "
            
            width:270
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
    
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: sprubgrv
            multiline:False
            
            width:270
            height: 50
            font_size: 24
        
        Label:
            text: "Label 14 "
            
            width:270
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
    
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
    
        TextInput:
            id: sprubdurm
            multiline:False
            
            width:270
            height: 50
            font_size: 24
        
        Label:
            text: "Label 15 "
            
            width:270
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
        
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
    
        TextInput:
            id: sprubmat
            multiline:False
            #pos_hint: {"x":0.57, "top":0.10}
        
            width:270
            height: 50
            font_size: 24
        
        Label:
            text: "Label 16 "
            width:270
            height: 50
            font_size: 24
            canvas.before:
                Color:
                    rgba: self.background_color
                Rectangle:
                    size: self.size                 
                    pos: self.pos
    
            color: utils.get_color_from_hex('#f2f5f7')
            bold: True
            italic: True
            
        TextInput:
            id: sprubnm
            multiline:False
            
            width:270
            height: 50
            font_size: 24
        
1 Answers

You can use Window.softinput_mode to control where the keyboard shows. I have found the following to be best for my uses:

Window.softinput_mode = ‘below_target’
Related