开发者

PyQt Scaling background image using styleSheet ? or any other way?

开发者 https://www.devze.com 2023-03-08 13:32 出处:网络
I\'m trying to resize a background image on a button btn.setStyleSheet(\"background-image: url(:/AddButton.png开发者_StackOverflow社区);\"

I'm trying to resize a background image on a button

btn.setStyleSheet("background-image: url(:/AddButton.png开发者_StackOverflow社区);"
                         "background-repeat: no-repeat;");

tried it with

background-size: 10px auto;

but pyqt seems to be missing this CSS attribute

Is there any other way of scaling the background image on the button? I need the background image as the icon on the button will be used on top.

any suggestions?


I believe you need to use border-image. Since the border-image property provides an alternate background, it is not required to specify a background-image when border-image is specified. In the case when both of them are specified, the border-image draws over the background-image.

0

精彩评论

暂无评论...
验证码 换一张
取 消