因此,我正在尝试使用Kivy创建某种行程应用程序,并且该应用程序运行良好,直到放入屏幕和屏幕管理器为止(注意:我只是在尝试屏幕,所以我只有1个)
这是我的python代码:
import kivy
kivy.require('1.10.0')
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.core.window import Window
from kivy.uix.screenmanager import ScreenManager, Screen
class WidgetLayout(FloatLayout):
pass
class KvScreenManager(ScreenManager):
pass
class TripsScreen(Screen):
pass
class ItineraryApp(App):
def build(self):
return KvScreenManager()
Window.size = (300, 400)
Window.clearcolor = (.4, .4, .4, 1)
ItineraryApp().run()
还有我的KV代码(我不知道为什么一行中有巨大的空白,即它的格式设置:
KvScreenManager:
TripsScreen:
<TripsScreen>:
name: 'TripsSreen'
WidgetLayout:
canvas.before:
Color:
rgb: 47/255, 167/255, 212/255
Rectangle:
size: root.width, 3
pos: 0, root.height/(400/328)
Label:
text: 'My Trips'
bold: True
size_hint: 1, (root.height/(400/70))/root.height
pos: 0, root.height/(400/330)
canvas.before:
Color:
rgb: .3, .3, .3
Rectangle:
size: self.size
pos: self.pos
Button:
text: 'Edit'
size_hint: (root.width/(300/70))/root.width, (root.height/(400 /35))/root.height
background_normal: ''
background_color: .4, .4, .4, .5
pos: root.width/(300/210), root.height/(400/347)
在没有屏幕的情况下,GUI是
但是在屏幕上,GUI是空白的
如果有人可以帮助我,那就太好了!