格式化Kivy弹出窗口以消除弹出背景 [英] Format Kivy popup to eliminate popup background
问题描述
我们在kivy应用程序中使用图像作为弹出窗口,但似乎无法使弹出窗口的背景适合图像的大小.出现的弹出窗口中的图像在图像的左侧,顶部和右侧均带有深灰色边框.有人可以帮助我们消除弹出窗口的背景,以便仅显示图像和半透明滤镜吗?
we're using an image as a popup in our kivy app but can't seem to get the popup's background to fit the size of the image. The resulting popup has the image with a dark gray border around the left side, top, and right side of the image. Can someone help us eliminate the popup's background so that only the image and the semi-transparent filter are visible?
Main.py代码:
Main.py code:
popup = Popup(title="",
content=Image(source='img/popup'),
auto_dismiss=True,
size_hint=(None, None),
size=(400, 146),
separator_height=0
)
谢谢
推荐答案
如果您没有标题,也许一个简单的ModalView会更适合您的目的.
If you don't have a title, maybe a simple ModalView would better fit your purposes.
无论哪种方式,背景都是由background
和background_color
属性控制的.要完全摆脱它,设置popup.background_color=(0, 0, 0, 0)
(即透明)可能是最简单的.
Either way, the background is controlled by the background
and background_color
properties. To get rid of it entirely, it's probably simplest to set popup.background_color=(0, 0, 0, 0)
(i.e. transparent).
这篇关于格式化Kivy弹出窗口以消除弹出背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!