Python GUI Classic Example using KivyMD and Kivy (ScreenManager, position, MD, Images, Carousel etc.)

 Wallpaper Application

Hi Guys! hope you all are doing well. I have created a GUI application based on python. I have used Kivy, Kivymd in this project to handle the material design.
In this example you can see Boxlayout, Swiping between different screens, Labels, Images and many more thing.

Requirement : Install Kivy, kivymd in you pc.

Below is the source code and output screenshot.
from kivymd.app import MDApp
from kivy.lang.builder import Builder
from kivy.uix.screenmanager import Screen,ScreenManager

screen_helper='''
ScreenManager:
MenuScreen:
ProfileScreen:
ImageScreen:

<MenuScreen>:
name : 'menu'

MDLabel:
text:'Hi! Happy to see you here.'
theme_text_color:'Custom'
text_color: 0.20,0.596,0.85,1
halign:'center'

MDTextField:
helper_text_mode: "on_focus"
helper_text: "What's your good name."
color_mode: 'accent'
size_hint: 0.2, 0.1
pos_hint: {'center_x':0.5,"center_y": .4}
width:50

MDRectangleFlatButton:
text:'Start! Tour'
pos_hint:{'center_x':0.5,'center_y':0.3}
on_press:root.manager.current = 'profile'

<ProfileScreen>
name:'profile'
MDLabel:
text:'Welcome!'
halign:'center'
theme_text_color:'Custom'
text_color: 0.20,0.596,0.85,1

MDRectangleFlatButton:
text:'Back'
pos_hint:{'center_x':0.5,'center_y':0.3}
on_press:root.manager.current = 'menu'

MDRectangleFlatButton:
text:'Gallery'
pos_hint:{'center_x':0.5,'center_y':0.4}
on_press:root.manager.current = 'image'

<ImageScreen>
name:'image'

BoxLayout:
orientation:'horizontal'

Carousel:
direction: 'right'
AsyncImage:
source: "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhupY-SXrw4W8LwYX8ZOS5eOGEL13NndFM1QHhKOgdTXGgbJEtWCrwEevDcCGwWHcMvkLe1CgGD-35uCMGRz4dXFnU0Q1E962Zz3bVDXGE8v2sFubWLUtetrVt-79F4MjroqIITvTRLdh0/s16000/IMG_20210109_093125_442.jpg"
allow_stretch:True
AsyncImage:
source: "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiLwj7__UEJIOS6rbxk5mcOOmeCSjrwVzZeIm4Fy1LgKe085nXAZjwDH9t6ll2R8_J5HQZi3EbwGJm7OPXA_BGZFg0IQA8ey4XC1k0_ei0plK2Q2Xx2gES2H5tOeNMJQ6A2gQKXvHXNBc/s16000/IMG_20210221_093900-01.jpeg"
allow_stretch:True
AsyncImage:
source: "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPvM5SU3DzeJULFr0jSucfJwwQJPxnmR0pXr5FgLLav6HKOGkX5wGKUVqxGEBNGjzOQj6JE_utMrvlcrqc5F1rTe2e7aub6IBkLYCZA8KQc1rvjTJ0f9tVhF_gZpLWDk76VRjcux2FVDo/s16000/IMG_20210214_084905-01.jpeg"
AsyncImage:
source: "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzJ7rAquw9vbOFEpUJy8Kd9mXq-1-50_vTABFltx9fzvxaeQOMfT3Yg0Ypuv1Ckh3rYMdewlFWgI143SaZYyWqzYaivbbj2KIQzOz2juHzQ_29i1vPZ09gu2bZsidbZFSVeE_OExwTYdg/s16000/IMG_20210214_080025-01.jpeg"
AsyncImage:
source: "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjidbVql0Jm01TC4MvXNGGtlTnKNUFBVIDEioOA8suZ1CdonSIS6MHGAON0yiB44Z0oZL6s8cYPxQaae2D5_FMFCaA-bdl9Vp8kNBWDdvulROYrGKIRx-XJRD5bzyWNGukcNsfz8qemm3M/s16000/IMG_20210129_081005-01.jpeg"

MDRectangleFlatButton:
text:'Back'
pos_hint:{'center_x':0.9,'center_y':0.9}
on_press:root.manager.current = 'menu'
'''

class MenuScreen(Screen):
pass

class ProfileScreen(Screen):
pass

class ImageScreen(Screen):
pass

sm = ScreenManager()
sm.add_widget(MenuScreen(name='menu'))
sm.add_widget(ProfileScreen(name='profile'))
sm.add_widget(ImageScreen(name='image'))

class MultiscreenApp(MDApp):

def build(self):
self.theme_cls.theme_style = "Dark"
screen = Builder.load_string(screen_helper)
return screen


MultiscreenApp().run()

__author__="Hemant Kumar"

After running the code.




Please let me know in case of any issue while installing or running this code.
Stay tuned! In the next example we will see how we can invert the colors.


















Comments

Popular posts from this blog

Download Application to convert Image to Pdf (Simple to Use)

Tkinter version of Python code for Image conversion into PDF.