Quick search

Application example using build() + return(翻訳済み)

pic3

self.rootを設定した場合、アプリケーションのwidgetはbuild()にreturnを設定してビルドできます。

File application\app_with_build.py

'''
Application example using build() + return
==========================================

An application can be built if you return a widget on build(), or if you set
self.root.
'''

import kivy
kivy.require('1.0.7')

from kivy.app import App
from kivy.uix.button import Button


class TestApp(App):

    def build(self):
        # return a Button() as a root widget
        return Button(text='hello world')


if __name__ == '__main__':
    TestApp().run()