[英]Python Kivy using Atlas
I've started using Kivy for python app's UI. 我已经开始将Kivy用于python应用程序的UI。 I want to style my buttons using an atlas with images.
我想使用带有图像的地图集来设置按钮样式。 I've created one, with some standard 100x100 png images: btn_up, btn_down.
我创建了一个,带有一些标准的100x100 png图像:btn_up,btn_down。
Button:
text: _('State')
font_size: 22
on_press: screens.current = 'current_state'
background_normal: 'atlas://res/bkts_atlas/btn_up'
background_down: 'atlas://res/bkts_atlas/btn_down'
The image on the buttons is stretched. 按钮上的图像被拉伸。 The default Kivy button (using defaultheme atlas) is rendered ok, even if the button image is a square-like image in the atlas.
即使按钮图像是地图集中的正方形图像,默认的Kivy按钮(使用defaultheme地图集)也会呈现为正常。 I mean it keeps a nice form when rendered even if the button size isn't square.
我的意思是即使按钮大小不是正方形,在呈现时它也保持良好的形式。 How can I fix it ?
我该如何解决? Thanks in advance.
提前致谢。
The Button stretches its image disproportionately in order to let you use a single image for different button shapes (note how the default image always has borders of the same width, no matter the button size). 按钮不均衡地拉伸其图像,以使您可以将单个图像用于不同的按钮形状(请注意,无论按钮大小如何,默认图像始终具有相同宽度的边框)。 I think the way to disable this is just to add
border: 0, 0, 0, 0
, or other options will have other effects. 我认为禁用此功能的方法只是添加
border: 0, 0, 0, 0
或其他选项将具有其他效果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.