파이썬[Python]: kivy - AccordionItem 클래스
kivy.uix.accordion 모듈 - AccordionItem 클래스(class)
/// 설명
Accordion과 연관된 클래스로 각 아이템을 형성합니다.
참고: uix 모듈 목록
※ 형식
AccordionItem(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.accordion.html
참고: uix 모듈 목록
※ 형식
AccordionItem(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.accordion.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.uix.accordion import Accordion, AccordionItem from kivy.uix.button import Button from kivy.uix.relativelayout import RelativeLayout class TestApp(App): def build(self): # making accordion root = Accordion(orientation='vertical') item_list = [] for x in range(5): item = AccordionItem(title=f'Title {x}') item_list.append(item) root.add_widget(item) # add Button into the AccordionItem bt0 = Button(text='Content 0', size_hint=(None, None), size=(200, 200)) bt1 = Button(text='Content 1', size_hint=(None, None), size=(200, 200)) bt2 = Button(text='Content 2', size_hint=(None, None), size=(200, 200)) bt3 = Button(text='Content 3', size_hint=(None, None), size=(200, 200)) bt4 = Button(text='Content 4', size_hint=(None, None), size=(200, 200)) item_list[0].add_widget(bt0) item_list[1].add_widget(bt1) item_list[2].add_widget(bt2) item_list[3].add_widget(bt3) item_list[4].add_widget(bt4) return root TestApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기