【发布时间】:2015-10-31 20:40:57
【问题描述】:
请帮我看看这段代码。每次运行它,它都会显示一个空白屏幕,我是 kivy 的新手。
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.screenmanager import ScreenManager,Screen
from kivy.lang import Builder
class first_screen(Screen):
pass
class second_screen(Screen):
pass
class my_manager(ScreenManager):
pass
Builder.load_file("testing_screens.kv")
class testing_screens(App):
def build(self):
return my_manager()
testing_screens().run()
<my_manager>:
first_screen:
second_screen:
<first_screen>:
name: "one"
Button:
text: "hello peeps"
on_press: app.root.current= "two"
<second_screen>:
name: "two"
Button:
text: "world gurus"
on_press: app.root.current= "one"
代码搞砸了。
【问题讨论】:
标签: kivy