以下代码在Windows上可以正常运行,但是当我尝试在kivy启动器上运行它时,它立即崩溃。 有一个kv文件以及脚本。 不幸的是,我一直在试图解决这个问题,但没有成功。 感谢任何帮助。
# -*- coding: utf-8 -*-
import kivy
kivy.require('1.1.3')
from kivy.app import App
#kivy.require("1.8.0")
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivy.uix.widget import Widget
class Painter(Widget):
pass
class MainScreen(Screen):
pass
class AnotherScreen(Screen):
pass
class AnotherScreen2(Screen):
pass
class AnotherScreen3(Screen):
pass
class ScreenManagement(ScreenManager):
pass
presentation = Builder.load_file("showcase.kv")
class MainApp(App):
def build(self):
return presentation
if __name__ in ('__main__', '__android__'):
MainApp().run()
哪个python脚本加载 名称:show.kv
#: import FadeTransition kivy.uix.screenmanager.FadeTransition
ScreenManagement:
transition: FadeTransition()
MainScreen:
AnotherScreen:
AnotherScreen2:
AnotherScreen3:
<MainScreen>:
name: "main"
FloatLayout:
Painter
Button:
text: "1"
on_release: app.root.current = "other"
color: 0,1,0,1
font_size: 40
size_hint: 0.3,0.2
pos_hint: {"right":1, "top":1}
Button:
text: "2"
on_release: app.root.current = "power"
color: 0,1,0,1
font_size: 40
size_hint: 0.3,0.2
pos_hint: {"x": 0, "top": 1}
Button:
text: "3"
on_release: app.root.current = "tube"
color: 0,1,0,1
font_size: 40
size_hint: 0.3,0.2
pos_hint: {"x": .5, "top": 1}
<AnotherScreen>:
name: "other"
FloatLayout:
Painter
Button:
color: 0,1,0,1
font_size: 40
size_hint: 0.3,0.2
text: "Back Home"
on_release: app.root.current = "main"
pos_hint: {"right":0.5, "top":1}
<AnotherScreen2>:
name: "power"
FloatLayout:
Painter
Button:
color: 0,1,0,1
font_size: 40
size_hint: 0.3,0.2
text: "Back Home"
on_release: app.root.current = "main"
pos_hint: {"right":0.5, "top":1}
<AnotherScreen3>:
name: "tube"
FloatLayout:
Painter
Button:
color: 0,1,0,1
font_size: 40
size_hint: 0.3,0.2
text: "Back Home"
on_release: app.root.current = "main"
pos_hint: {"right":0.5, "top":1}