Skip to main content

MDIconButton

CREATING A ICON BUTTON USING KIVYMD  





Link of Video on You tube :-  https://youtu.be/_nsvUQtRgNI

Following are the steps that are required to create a Icon button :

  



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 a button using MDIconButton 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 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 MDIconButton class
1. icon - name of icon to be printed on the screen.

Note :- you can get the list of ICON name by using this url 

2. pos_hint -  To place the button at particular position (takes float values)
3. theme_text_color : To change the color of icon (Values Primary, Secondary, Hint, Error and Custom)

Note : When the value of theme_text_color is Custom then we can use text_color attribute to change the color.

4. text_color - To change the color of icon (Takes color values in rgb fromat)
5. user_font_size - To increase size of icon (takes numeric value)
6. md_bg_color -  To change the background color of button (takes value in rgb format)
7. on_press - Action to be performed when button is pressed
8.on_release - Action to be performed when the button is released

Following is the code of this program :-

# Code of Python Program

from kivymd.app import MDApp

class Myapp(MDApp):
    def build(self):
        return

Myapp().run()

# save this by .py extension

# Code of kivy file

MDScreen :
    md_bg_color : [0,1,0,1]
    MDIconButton :
        icon : "language-python"
        pos_hint : {"center_x":.5,"center_y":.5}
        user_font_size : 100
        theme_text_color : "Custom"
        text_color : [0,0,1,1]
        on_press : self.text_color = [1,0,0,1]
        on_release : self.text_color =  [0,0,1,1]
    
# Save this by Myaap.kv name

Comments

Popular posts from this blog

LOGIN page (Projects)

Creating a LOGIN page using KIVYMD Video link on YouTube -   https://youtu.be/2ImbdfgY0Gg Following classes are required to create a login page :- 1. MDApp - To create a App 2. MDScreen - To create a screen 3. MDCard - To create a Card  4. MDLabel - To create a Label 5. MDTextFieldRound - To take ID and Password Input from user 6. MDRoundFlatButton - To create a sign-up button Note :- 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 code of LOGIN page # Code of Python Program from  kivymd.app  import  MDApp class   Myapp ( MDApp ):      def   build ( self ):          return Myapp().run() # Save it by .py extension # Code of KIVY File MDScreen :     md_bg_color :  [ 35 / 255 , 59 / 255 , 54 / 255 , 1 ]     MDCard :         size_hint :  None,None         size :   320 , 400         pos

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 pos_hint : {"ce

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 ]             left_action_items :  [[ 'menu' , lambda x : print( 'menu' )]]             right_action_items :  [[ 'magnify' , lambda x : print( 'serach' )],[ 'dots-vertical' , lambda x : print( 'vertical dots' )]]                  ScrollView :             MDGridLayout :                 cols :   2                 size_hint_y :   2 . 4                 MDCard :                     size_hint_x :  . 5                     size_hint_y :  . 3