Kivy Course #6 – Text Input and Input Handling

At the sixth part of the course, we are talking about text input and handling the text in text input box. To make a input chance to the user, TextInput class can be used. Here, a login system is made by making username and password check and afterwards, print the result to the console.

Python file:

from import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from import NumericProperty

from kivy.clock import Clock

class RootWidget(GridLayout):
    def validateUser(self):
        if self.ids.username.text == 'masti' and \
            self.ids.sifre.text == 'strong':
            print "Iyi giris"
            print 'hatali bilgi'

class kullaniciApp(App):
    def build(self):
        return RootWidget()

if __name__ == "__main__":
    App = kullaniciApp()

Kivy file:

    rows: 2
    cols: 2
        text: "User name"
        id: username
        multiline: False
        text: "Password"
        id: sifre
        password: True
        multiline: False
        on_text_validate: root.validateUser()
comments powered by Disqus