파이썬[Python]: kivy - Button 클래스
kivy.uix.button 모듈 - Button 클래스(class)
/// 설명
누르거나(press) 뗄 수(release) 수 있는 라벨입니다.
참고: uix 모듈 목록
※ 형식
Button(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.button.html
참고: uix 모듈 목록
※ 형식
Button(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.button.html
/// 예제
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.uix.button import Button class TestApp(App): def build(self): test_button = Button(text='GUI Programming, It is interesting') return test_button TestApp().run() | cs |
/// 출력
/// 예제 size_hint
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.uix.button import Button class TestApp(App): def build(self): # size_hint x=50%, y=50% test_button = Button(text='GUI Programming, It is interesting', size_hint=(.5, .5)) return test_button TestApp().run() | cs |
/// 출력
/// 예제 size_hint and pos
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.uix.button import Button class TestApp(App): def build(self): # size_hint x=50%, y=50% # (left, bottom) (left+200, bottom+150) test_button = Button(text='GUI Programming, It is interesting', size_hint=(.5, .5), pos=(200, 150)) return test_button TestApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기