파이썬[Python]: kivy - ActionButton 클래스
kivy.uix.actionbar 모듈 - ActionButton 클래스(class)
/// 설명
ActionBar의 하위 위젯중 하나입니다. 버튼의 역활을 합니다.
참고: uix 모듈 목록
※ 형식
ActionButton(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.actionbar.html
참고: uix 모듈 목록
※ 형식
ActionButton(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.actionbar.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 40 41 42 43 44 45 46 47 48 49 50 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.core.window import Window from kivy.uix.actionbar import * from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from functools import partial Window.clearcolor = (.5, .0, .5, .1) Window.size = (563, 1001) Window.top, Window.left = 30, 800 class TestApp(App): def abt_press(self, lb, abt_instance): print(abt_instance) lb.text = 'Is\'n it?' def abt_release(self, lb, abt_instance): print(abt_instance) lb.text = 'GUI Programming, It is interesting' def build(self): # making Label lb = Label(text='GUI Programming, It is interesting', font_size=35) # making ActionBar ab = ActionBar(pos_hint={'top': 1}) av = ActionView() av.use_separator = True av.add_widget(ActionPrevious(title='Action Bar')) av.add_widget(ActionButton(text='Button', on_press=partial(self.abt_press, lb), on_release=partial(self.abt_release, lb))) ab.add_widget(av) # root(Label+ActionBar) bl = BoxLayout(orientation='vertical') bl.add_widget(ab) bl.add_widget(lb) return bl TestApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기