I am trying to make a header label with text over a background image. I'm using the image like a spacer image, so it should stretch the width of the label. I have been able to get the image in the background; however I can't figure out how to make it stretch. Here is the code:
brush.
setTexture(QtGui.
QPixmap("Images/small_border.png"))brush.setStyle(QtCore.Qt.TexturePattern)
self.ui.label_2.setPalette(palette)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(170, 255, 0))
brush.setTexture(QtGui.QPixmap("Images/small_border.png"))
brush.setStyle(QtCore.Qt.TexturePattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
self.ui.label_2.setPalette(palette)
To copy to clipboard, switch view to plain text mode
The image is being displayed in the TexturePattern, just as it should given the style. However I don't see a way to set the style so that it will stretch the image to fill the space. How can I do that?
Thanks
Bookmarks