파이썬[Python]: kivyMD - MDGridLayout 클래스
kivymd.uix.gridlayout 모듈 - MDGridLayout 클래스(class)
/// 설명 (kivy + kivyMD)
하위 위젯들을 격자무늬형태로 정렬합니다.(프로그램에 의해 자동 배치되어집니다.)
참고: kivyMD 모듈 목록
※ 형식
MDGridLayout(**kwargs)
reference
https://kivymd.readthedocs.io/en/latest/components/gridlayout/
참고: kivyMD 모듈 목록
※ 형식
MDGridLayout(**kwargs)
reference
https://kivymd.readthedocs.io/en/latest/components/gridlayout/
/// 예제
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 | import kivy kivy.require('2.0.0') from kivy.core.window import Window from kivy.uix.button import Button from kivymd.app import MDApp from kivymd.uix.gridlayout import MDGridLayout Window.clearcolor = (0, 0, 0, 1) Window.size = (563, 1001) Window.top, Window.left = 30, 700 class FantasticApp(MDApp): def build(self): MDgl = MDGridLayout(cols=2, pos_hint={'top': 1}, adaptive_height=True) bt0 = Button(text='MDGridLayout', background_color=(0.1, 1, 0.1, 1)) bt1 = Button(text='MDGridLayout', background_color=(0.1, 1, 0.1, 1)) bt2 = Button(text='MDGridLayout', background_color=(0.1, 1, 0.1, 1)) bt3 = Button(text='MDGridLayout', background_color=(0.1, 1, 0.1, 1)) MDgl.add_widget(bt0) MDgl.add_widget(bt1) MDgl.add_widget(bt2) MDgl.add_widget(bt3) return MDgl FantasticApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기