파이썬[Python]: kivy - build_config 메서드
kivy.app 모듈 - App 클래스 - build_config 메서드(method)
/// 설명
ConfigParser 객체를 생성하기 위하여 애플리케이션이 초기화되기 전 호출되어집니다.
기본 config 를 생성하기 위하여 section / key / value 를 입력하실 수 있습니다.
get_application_config() 에 의해 반환됩니다.
참고: animation to gesture 모듈 목록
※ 형식
build_config(config)
reference
https://kivy.org/doc/stable/api-kivy.app.html
기본 config 를 생성하기 위하여 section / key / value 를 입력하실 수 있습니다.
get_application_config() 에 의해 반환됩니다.
참고: animation to gesture 모듈 목록
※ 형식
build_config(config)
reference
https://kivy.org/doc/stable/api-kivy.app.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  | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.core.window import Window from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from kivy.uix.label import Label Window.clearcolor = (.6, 1, .8, 1) Window.size = (563, 1001) Window.top, Window.left = 30, 800 class FantasticApp(App):     def build_config(self, config):         config.setdefaults('section', {             'key1': 'value',             'key2': '100'         })     def bt_pressed(self, bt_instance):         key1 = self.config.get('section', 'key1')         key2 = self.config.getint('section', 'key2')         self.lb.text = f'[color=606060][section]\nkey1: {key1}\nkey2: {key2}[/color]'     def build(self):         config = self.config         bt = Button(text='See: ./yuor_app_name.ini', size_hint=(1, None), height=100,                     on_press=self.bt_pressed)         self.lb = lb = Label(text='[color=606060]None[/color]', font_size=50,                              markup=True)         bl = BoxLayout(orientation='vertical')         bl.add_widget(bt)         bl.add_widget(lb)         return bl FantasticApp().run()  | cs | 
/// 출력
댓글
댓글 쓰기