PRINTING A ICON ON THE SCREEN USING KIVYMD
Link of Video on You tube :- https://youtu.be/TsEUSwJm6CI
Following are the steps that are required to print an Icon on the screen using kivymd :
1. Creating the App by importing the MDApp class of kivymd module
2. Creating the Screen by using MDScreen class of kivymd module
3. Printing the Icon on the screen using MDIcon 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 MDIcon 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. halign - To horizontally align the text on the screen (Values center,left,right)
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. font_size - To increase size of icon (takes numeric value)
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 : [1,0,0,1]
radius : [25,0,25,0]
MDIcon :
icon : "language-python"
halign : "center"
theme_text_color : "Custom"
text_color : [0,0,1,1]
font_size : 100
# Save this by Myaap.kv name
Comments
Post a Comment