python - kivy中的静态背景
问题描述
我想知道是否有办法在带有屏幕管理器的 Kivy 应用程序中获取静态背景。对于静态,我的意思是即使在切换屏幕时,背景也会保持原样。我正在使用 .kv 文件进行布局。我猜这与 .kv 文件中的放置顺序有关。
谢谢!
解决方案
您可以使用浮动布局作为每个屏幕中的根小部件,并将图像和屏幕中的其他布局添加到浮动布局中,这是 kv 中的代码示例:
Screen: # Screen 1
id: Home
FloatLayout:
Image:
source: "path to the image"
BoxLayout: # Here you put your other layout
# And here the code you had
Screen: # Screen 2
id: Another Screen
FloatLayout:
Image:
source: "path to the image"
BoxLayout: # Here you put your other layout
# And here the code you had
这是我知道的解决方案,它可能不适合您,但我会将其他选择留给其他人......
推荐阅读
- r - 如何用公式格式化ggplot`geom_text`,得到不需要的“c(...)”
- mysql - MySQL从同一行不同列中选择最后输入日期和值
- reactjs - redux-form 验证:最小长度和匹配密码
- python - 两组生成html标签
- javascript - 我如何构建我的代码以使对象位于它们自己的文件中?
- sql - Oracle SQL 面试关于物化视图的问题?
- mysql - 显示从 mysql 数据库到 laravel 刀片视图的 json 数组数据
- amazon-web-services - 错误:找不到 JobId 服务:AmazonRekognition;状态码:400;
- r - R - SpatialLinesDataFrame 与 SpatialPolygonsDataFrame 对象相交的列表的嵌套循环
- python - 无法在文本预处理中用空格替换数字