Kivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.
👉🏽 Kivy Tutorial – Learn Kivy with Examples.
TextInput:
The TextInput widget provides a box for editable plain text. Unicode, multiline, cursor navigation, selection and clipboard features are supported.
To create a multiline TextInput (the ‘enter’ key adds a new line).
To create a singleline TextInput, set the TextInput.multiline property to False.
TextInput(text='Hello world', multiline=False)
To work with Textinput you have to import it by the command –
from kivy.uix.textinput import TextInput
Basic Approach:
1) import kivy
2) import kivyApp
3) import Label
4) import Scatter
5) import Floatlayout
6) import Textinput
7) import BoxLayout
8) Set minimum version(optional)
9) create App class
10) return Layout/widget/Class(according to requirement)
11) Run an instance of the class
Now the implementation of the Approach:
import kivy
from kivy.app import App
kivy.require( '1.9.0' )
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.scatter import Scatter
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout
class TutorialApp(App):
def build( self ):
b = BoxLayout(orientation = 'vertical' )
t = TextInput(font_size = 50 ,
size_hint_y = None ,
height = 100 )
f = FloatLayout()
s = Scatter()
l = Label(text = "Hello !" ,
font_size = 50 )
f.add_widget(s)
s.add_widget(l)
b.add_widget(t)
b.add_widget(f)
t.bind(text = l.setter( 'text' ))
return b
if __name__ = = "__main__" :
TutorialApp().run()
|
Output:

After some input –

Last Updated :
18 Oct, 2021
Like Article
Save Article
Vote for difficulty
Current difficulty :
Basic