【发布时间】:2019-01-08 14:03:12
【问题描述】:
我正在尝试更改游戏菜单的背景。但我似乎找不到使用 kivy 插件的方法。
这是我的 .kv 文件。
ScreenManagement :
transition : FadeTransition()
MainMenu :
ThemeMenu :
<MainMenu> :
name : 'main'
Label :
size_hint : 1 , 1
Rectangle:
pos: self.pos
size: self.size
source: 'Background.jpeg'
Button :
id : 'Play'
background_normal : 'Play button.png'
background_down : 'Play Button - Press.png'
size_hint : 0.3 , 0.85
pos_hint : {'x' : 0.04 , 'y' : 0.03}
on_release : app.clickfx()
Button :
background_normal : 'Theme button.png'
background_down : 'Themes button - Press.png'
size_hint : 0.6 , 0.42
pos_hint : {'x' : 0.35 , 'y' : 0.46}
on_release : app.root.current = 'theme'
on_release : app.clickfx()
Button :
background_normal : 'Setting button.png'
background_down : 'Settings button - Press.png'
size_hint : 0.295 , 0.42
pos_hint : {'x' : 0.35 , 'y' : 0.03}
on_release : app.clickfx()
Button :
background_normal : 'About button.png'
background_down : 'Abouts button - Press.png'
size_hint : 0.295 , 0.42
pos_hint : {'x' : 0.655 , 'y' : 0.03}
on_release : app.clickfx()
Image :
source : 'Header.png'
size_hint : 1.2 , 1
pos_hint : {'x' : -0.1, 'y' : 0.51}
Image :
source : 'Pong X.png'
size_hint : 0.1 , 0.1
pos_hint : {'x' : 0.005 , 'y' : 0.92 }
<ThemeMenu> :
name : 'theme'
感谢任何帮助:D
【问题讨论】:
-
stackoverflow.com/questions/31179155/… 看看这个并尝试将图像放在与您的代码相同的目录中(我建议您将所有代码和图像放在一个单独的文件夹中)