파이썬[Python]: kivyMD - SmartTileWithLabel 클래스

kivymd.uix.imagelist 모듈 - SmartTileWithLabel 클래스(class)


/// 설명 (kivy + kivyMD)

여러 이미지들에 라벨을 사용할 수 있습니다.(MDGridLayout 사용)

참고: kivyMD extra 모듈 목록

※ 형식
SmartTileWithLabel(**kwargs)

reference
https://kivymd.readthedocs.io/en/latest/components/imagelist/#smarttilewithlabel

/// 예제

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
import kivy
 
kivy.require('2.0.0')
 
from kivy.core.window import Window
from kivy.uix.scrollview import ScrollView
 
from kivymd.app import MDApp
from kivymd.uix.screen import MDScreen
from kivymd.uix.gridlayout import MDGridLayout
from kivymd.uix.imagelist import SmartTileWithLabel
 
Window.size = (5631001)
Window.top, Window.left = 30700
 
 
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=(25252525), md_bg_color=(1111))
        # -------------------------------------------------------------------------
 
        MDgl = MDGridLayout(cols=1, adaptive_height=True, padding=(250), spacing=5)
 
        MDgl.add_widget(SmartTileWithLabel(
                              source='./image01.jpg', size_hint_y=None, height=200,
                              text='[size=26]Image 1[/size]\n[size=14]image01.jpg[/size]'))
        MDgl.add_widget(SmartTileWithLabel(
                              source='./image02.jpg', size_hint_y=None, height=200,
                              text='[size=26]Image 2[/size]\n[size=14]image02.jpg[/size]'))
        MDgl.add_widget(SmartTileWithLabel(
                              source='./image03.jpg', size_hint_y=None, height=200,
                              text='[size=26]Image 3[/size]\n[size=14]image03.jpg[/size]'))
        MDgl.add_widget(SmartTileWithLabel(
                              source='./image04.jpg', size_hint_y=None, height=200,
                              text='[size=26]Image 4[/size]\n[size=14]image04.jpg[/size]'))
        MDgl.add_widget(SmartTileWithLabel(
                              source='./image05.jpg', size_hint_y=None, height=200,
                              text='[size=26]Image 5[/size]\n[size=14]image05.jpg[/size]'))
        MDgl.add_widget(SmartTileWithLabel(
                              source='./image06.jpg', size_hint_y=None, height=200,
                              text='[size=26]Image 6[/size]\n[size=14]image06.jpg[/size]'))
 
        sv = ScrollView()
        sv.add_widget(MDgl)
        MDs.add_widget(sv)
        return MDs
 
 
FantasticApp().run()
 
cs

/// 출력

/// 사용 파일


* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)


– 당신을 응원합니다. –

댓글

이 블로그의 인기 게시물

파이썬[Python]: 내장함수 - from_bytes 메서드

파이썬[Python]: 내장함수 - __len__ 메서드

파이썬[Python]: kivy - 한글 사용

파이썬[Python]: 내장함수 - bit_length 메서드

C 언어: sin 함수, cos 함수, tan 함수