tdgs
tdgs

Reputation: 11

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

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

btn.setStyleSheet("background-image: url(:/AddButton.png);"
                         "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?

Upvotes: 1

Views: 2937

Answers (1)

Jeffers
Jeffers

Reputation: 21

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.

Upvotes: 2

Related Questions