파이썬[Python]: kivyMD - MDSwiper 클래스
kivymd.uix.swiper 모듈 - MDSwiper 클래스(class)
/// 설명 (kivy + kivyMD)
슬라이드 형식의 위젯입니다.
참고: kivyMD 모듈 목록
※ 형식
MDSwiper(**kwargs)
reference
https://kivymd.readthedocs.io/en/latest/components/mdswiper/
참고: kivyMD 모듈 목록
※ 형식
MDSwiper(**kwargs)
reference
https://kivymd.readthedocs.io/en/latest/components/mdswiper/
/// 예제
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | import kivy kivy.require('2.0.0') from kivy.core.window import Window from kivy.uix.image import Image from kivymd.app import MDApp from kivymd.uix.screen import MDScreen from kivymd.uix.swiper import MDSwiper, MDSwiperItem from kivymd.uix.label import MDLabel Window.size = (563, 1001) Window.top, Window.left = 30, 700 class FantasticApp(MDApp): def build(self): # Phone-like -------------------------------------------------------------- self.theme_cls.theme_style = "Dark" MDs = MDScreen(pos_hint={'right': .995, 'top': .985}, size_hint=(.99, .98), radius=(25, 25, 25, 25), md_bg_color=(1, 1, 1, 1)) # ------------------------------------------------------------------------- MDsw = MDSwiper(size_hint_y=None, height=300, y=Window.size[1]-350) MDswi1 = MDSwiperItem() MDswi1.add_widget(Image(source='./image01.jpg')) MDswi2 = MDSwiperItem() MDswi2.add_widget(Image(source='./image02.jpg')) MDswi3 = MDSwiperItem() MDswi3.add_widget(Image(source='./image03.jpg')) MDswi4 = MDSwiperItem() MDswi4.add_widget(Image(source='./image04.jpg')) MDswi5 = MDSwiperItem() MDswi5.add_widget(Image(source='./image05.jpg')) MDswi6 = MDSwiperItem() MDswi6.add_widget(Image(source='./image06.jpg')) MDsw.add_widget(MDswi1) MDsw.add_widget(MDswi2) MDsw.add_widget(MDswi3) MDsw.add_widget(MDswi4) MDsw.add_widget(MDswi5) MDsw.add_widget(MDswi6) MDs.add_widget(MDLabel(text='MDSwiper', halign='center', theme_text_color='Custom', text_color=(0, .5, .5, 1))) MDs.add_widget(MDsw) return MDs FantasticApp().run() | cs |
/// 출력
/// 사용 파일
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기