파이썬[Python]: kivy - FileChooserIconView 클래스 - kv
kivy.uix.filechooser 모듈 - FileChooserIconView 클래스(class)
/// 설명
아이콘을 사용하여 FileChooserController 를 구현한 클래스입니다.
참고: uix 모듈 목록
※ 형식
FileChooserIconView(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.filechooser.html
참고: uix 모듈 목록
※ 형식
FileChooserIconView(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.uix.filechooser.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 | import kivy kivy.require('2.0.0') import os from kivy.app import App from kivy.core.window import Window from kivy.lang import Builder Window.clearcolor = (.6, 1, .8, 1) Window.size = (563, 1001) Window.top, Window.left = 30, 800 kv = ''' #:import os os BoxLayout: orientation: 'vertical' TextInput: id: id_ti FileChooserIconView: id: id_fciv path: os.getcwd() filters: [\'*.txt\', \'*.py\', \'*.ini\'] Button: text: 'Load File' size_hint_y: None height: 200 on_release: app._load(self, id_fciv, id_ti) ''' class FantasticApp(App): def _load(self, bt_instance, fciv, id_ti): with open(os.path.join(fciv.path, fciv.selection[0])) as stream: id_ti.text = stream.read() id_ti.cursor = (0, 0) # move cursor def build(self): return Builder.load_string(kv) FantasticApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
magmordupyo Mike Anderson Recover My Files
답글삭제Kaspersky AntiVirus
ESET NOD32 Internet Security
fectpaddrahi