파이썬[Python]: kivy - TreeView 클래스
kivy.uix.treeview 모듈 - TreeView 클래스(class)
/// 설명
트리구조를 표현하는 위젯입니다.
참고: uix 모듈 목록
※ 형식
TreeView(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.treeview.html
참고: uix 모듈 목록
※ 형식
TreeView(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.treeview.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 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.core.window import Window from kivy.uix.treeview import TreeView, TreeViewLabel from kivy.uix.boxlayout import BoxLayout Window.clearcolor = (.5, .5, 1, .1) class TestApp(App): def build(self): bl = BoxLayout() # making TreeView(Left) tv1 = TreeView() tv1.add_node(TreeViewLabel(text='Sub Tree1')) tv1.add_node(TreeViewLabel(text='Sub Tree2')) # making TreeView(Right) tv2 = TreeView() st1 = tv2.add_node(TreeViewLabel(text='Sub Tree1')) tv2.add_node(TreeViewLabel(text='Sub-sub Tree1'), st1) tv2.add_node(TreeViewLabel(text='Sub-sub Tree2'), st1) st2 = tv2.add_node(TreeViewLabel(text='Sub Tree2')) tv2.add_node(TreeViewLabel(text='Sub-sub Tree1'), st2) tv2.add_node(TreeViewLabel(text='Sub-sub Tree2'), st2) bl.add_widget(tv1) bl.add_widget(tv2) return bl TestApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기