QFrame setStyleSheet background-image not working on Windows
-
@retconx said in QFrame setStyleSheet background-image not working on Windows:
Does anyone has an idea, why?
Well, what exactly is path-to-png-image? Where is the image stored?
-
@jsulm The original code line is:
frame.setStyleSheet("background-image:url(" + os.path.join(basedir, "pictures", "image.png") + "); background-position:center; background-repeat:no-repeat;")Pasting the output of print(os.path.join(basedir, "pictures", "image.png")) to Windows Explorer opens the picture. So the path should be valid.
-
@jsulm No difference, unfortunately.
That is acutally the reason why I use os.path.join in order to get backslashes for Windows an forwardslashes for Mac/Linux.
And as I said, the path with backslashes works in Windows Explorer.Maybe it has to do with any QFrame properties (shape, style...) which have to be set in Windows to show background-images? I will try a bit...