In this video I’ll build out a basic Image Swiper app with KivyMD and Python.
Image swiper apps are fun little apps that allow you to create a portfolio of images that you can swipe thru easily. KivyMD makes it really easy to build them and that’s what I’m going to do in this video.
We’ll use MySwiper@MDSwiperItem, MDSwiper, and MySwiper in the kv file to do most of the work.
#kivy #codemy
Python Code: swiper.py
GitHub Code: swiper.py
from kivy.lang import Builder from kivymd.app import MDApp class MainApp(MDApp): def build(self): self.theme_cls.theme_style = "Dark" self.theme_cls.primary_palette = "BlueGray" return Builder.load_file('swiper.kv') MainApp().run()
Kivy Design Code: swiper.kv
GitHub Code: swiper.kv
<MySwiper@MDSwiperItem> #FitImage: # source: "images/aspen.png" # radius: [20,] MDScreen: MDToolbar: id: toolbar title: "Our Swiper App" elevation: 10 pos_hint: {"top": 1} MDSwiper: size_hint_y: None height: root.height - toolbar.height - dp(40) y: root.height - self.height - toolbar.height - dp(20) MySwiper: FitImage: source: "images/aspen.png" radius: [20,] MySwiper: FitImage: source: "images/aspen2.png" radius: [20,] MySwiper: FitImage: source: "images/aspen3.png" radius: [20,] MySwiper: FitImage: source: "images/aspen4.png" radius: [20,] MySwiper: FitImage: source: "images/me.png" radius: [20,]
Add comment