我试图用Kivy来显示背景图片,所以我想让根部件与图片大小相同。目前,当我从kv文件加载图像时,它显示为左下角的小缩略图。应用程序窗口似乎是正确的(全尺寸)大小,但很难说。下面的代码,有什么想法?图片在基维的尺寸是错误的
.kv文件:
#:kivy 1.8.0
<BarBot_splash>:
BoxLayout:
size: image.size
Image:
id: image
source: 'MainMenu.png'
.py文件:
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.uix.widget import Widget
class BarBot_splash(Widget):
def on_touch_up(self, touch):
if touch.x < self.width/3:
#we touched the menu button
pass
elif touch.x > self.width/3*2:
#we touched the custom button
pass
else:
return False
class BarBot(App):
def build(self):
return BarBot_splash()
if __name__=='__main__':
BarBot().run()