파이썬[Python]: kivy - RelativeLayout 클래스
kivy.uix.relativelayout 모듈 - RelativeLayout 클래스(class)
/// 설명
FloatLayout과 비슷하지만, 하위 위젯들에게 상대적인(윈도우가 아닌 RelativeLayout 내에서의 좌표)좌표를 사용하게합니다.
참고: uix 모듈 목록
※ 형식
RelativeLayout(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.relativelayout.html
참고: uix 모듈 목록
※ 형식
RelativeLayout(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.relativelayout.html
/// 예제
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 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.core.window import Window from kivy.uix.button import Button from kivy.uix.boxlayout import BoxLayout from kivy.uix.relativelayout import RelativeLayout Window.clearcolor = (.5, .5, 1, .1) class TestApp(App): def build(self): bl = BoxLayout() # BoxLayout - Button - Start lb = Button(text='Button') # BoxLayout - Button - End # BoxLayout - RelativeLayout - Start rll = RelativeLayout() bt = Button(text='Button in the RelativeLayout\nPosition(50, 50)', size_hint=(.5, .5), pos=(50, 50)) rll.add_widget(bt) # BoxLayout - RelativeLayout - End # BoxLayout bl.add_widget(lb) bl.add_widget(rll) return bl TestApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기