파이썬[Python]: kivyMD - MDRelativeLayout 클래스
kivymd.uix.gridlayout 모듈 - MDRelativeLayout 클래스(class)
/// 설명 (kivy + kivyMD)
FloatLayout과 비슷하지만, 하위 위젯들에게 상대적인(윈도우가 아닌 RelativeLayout 내에서의 좌표)좌표를 사용하게합니다.
참고: kivyMD 모듈 목록
※ 형식
MDRelativeLayout(**kwargs)
reference
https://kivymd.readthedocs.io/en/latest/components/relativelayout/
참고: kivyMD 모듈 목록
※ 형식
MDRelativeLayout(**kwargs)
reference
https://kivymd.readthedocs.io/en/latest/components/relativelayout/
/// 예제
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 | 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.boxlayout import MDBoxLayout from kivymd.uix.relativelayout import MDRelativeLayout Window.clearcolor = (0, 0, 0, 1) Window.size = (563, 1001) Window.top, Window.left = 30, 700 class FantasticApp(MDApp): def build(self): MDrl = MDRelativeLayout(radius=(25, 25, 25, 25), md_bg_color=self.theme_cls.primary_light) bt_rl = Button(text='RelativeLayout', pos_hint={'center_x': .5, 'center_y': .5}, size_hint=(.5, .5), background_color=(0.1, 1, 0.1, 1)) MDrl.add_widget(bt_rl) bt = Button(text='RelativeLayout', background_color=(0.1, 1, 0.1, 1)) MDbl = MDBoxLayout(orientation='vertical') MDbl.add_widget(MDrl) MDbl.add_widget(bt) return MDbl FantasticApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기