Skip to main content

MDTextFieldRect

TAKING INPUT FROM USER USING MDTEXTFIELDRECT WIDGET


Link of Video on You Tube - https://youtu.be/a3Kqj0RDW2E



Following are the steps that are required to take input from user :

  


1. Creating the App by importing the MDApp class of kivymd module.
2. Creating the Screen by using MDScreen class of kivymd module.
3. Creating Text Field using MDTextFieldRect Class

First Create a Python file (extension .py) then, create a kivy file (.kv extension) name of kivy file should be same as app name.

App name is the name of the class that consist of build function and created by inheriting the MDApp class

Following is the list of attributes used in this program :-

Attributes of MDScreen class
1. md_bg_color - To change the background color 
2. radius - to change the corner radius of screen

Attributes of MDTextFieldRect class
1. hint_text - To print hint text on text field (Takes String).
2. pos_hint - To change the position of button (Takes values in dictionary format like pos_hint : {"center_x":.5,"center_y":.5}.
3.  size_hint - To change the size of field along x and y axis (Takes float type values and None,None ).
4. size- used when the value of size_hint is None (Takes Numeric values like 100, 200).
5. background_color - To change then background color of text field (Takes values in RGB format).
6. foreground_color - To change the color of input text (Takes Values in RGB format).
7. hint_text_color -  To change the color of hint text (Takes values in RGB format).
8. password - To take password input from user (Takes True or False).
9. password_mask - To change the password mask (Takes a String)

Following is the code of this program :-

1. Code of Python program (Save it by .py extension)

from kivymd.app import MDApp

class Myapp(MDApp):
    def build(self):
        return
    def get_data(self):
        print("The data of text field is :: ",self.root.ids.data.text)

Myapp().run()

2. Code of Kivy program (Save it by name Myapp.kv)

MDScreen :
    MDTextFieldRect :
        id : data
        hint_text : "Username"
        pos_hint : {"center_x":.5,"center_y":.5}
        size_hint : None,None
        size : 300,40
        font_size : 20
        foreground_color : [1,0,0,1]
        background_color : [0,0,0,.2]
        hint_text_color : [0,0,1,1]
    MDRectangleFlatIconButton :
        text : 'Submit '
        icon : "language-python"
        pos_hint : {"center_x":.5,"center_y":.3}
        font_size : 20
        on_press : app.get_data()

Image of Text Field :-


Comments

Popular posts from this blog

Photo Shoot Page

C REATING A PHOTO SHOOT PAGE USING KIVYMD Code of python Program # Code of Python Program from   kivymd . app   import   MDApp from   kivy . core . window   import   Window Window .size = ( 360 , 600 ) class   Myapp ( MDApp ):      def   build ( self ):          return Myapp (). run () Code of kivy program  # Code of kivy Program MDScreen :     MDBoxLayout :         orientation :   'vertical'         MDToolbar :               title :   'Photo Shoots'             md_bg_color :  [ 0 , 0 , 1 , 1 ]            ...

MDTextFieldRound

TAKING INPUT FROM USER USING MDTEXTFIELDROUND WIDGET Link of Video on You Tube -  https://youtu.be/b5B9KkYa1Mo Following are the steps that are required to take input from user :    1. Creating the App by importing the MDApp class of kivymd module. 2. Creating the Screen by using MDScreen class of kivymd module. 3. Creating Text Field using MDTextFieldRound Class First Create a Python file (extension .py) then, create a kivy file (.kv extension) name of kivy file should be same as app name. App name is the name of the class that consist of b uild function and created by inheriting the MDApp class Following is the list of attributes used in this program :- Attributes of MDScreen class 1. md_bg_color - To change the background color  2. radius - to change the corner radius of screen Attributes of MDTextFieldRound class 1. hint_text - To print hint text on text field (Takes String). 2. pos_hint - To change the position of button (Takes values in dictionary format like p...

MDToolbar (Bottom)

CREATING TOOLBAR(Bottom) USING KIVYMD Link of video On YouTube :-  https://youtu.be/gsj97f5r6nQ Following are the steps that are required to create Toolbar :    1. Creating the App by importing the MDApp class of kivymd module. 2. Creating the Box Layout by using MDBoxLayout class of kivymd module. 3. Placing the toolbar in the bottom of the screen by using MDBottomAppBar class of kivymd. 4. Creating Toolbar using MDToolbar class of kivymd module. First Create a Python file (extension .py) then, create a kivy file (.kv extension) name of kivy file should be same as app name. App name is the name of the class that consist of b uild function and created by inheriting the MDApp class Following is the list of attributes used in this program :- Attributes of MDBoxLayout class 1. md_ bg_color - To change the background color (Takes values in RGB format). 2. orientation - To change the orientation of items of box layout (Takes values vertical and  horizontal). Attributes of...