I wonder how do I set background color AND background image in Python GUI app using PyQt5. I can't figure out how to set them simultaneously. I tried doing
self.window.setStyleSheet("* {color: qlineargradient(spread:pad, x1:0 y1:0, x2:1 y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));"
"background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #ffc982, stop:1 #ff9982);}; background-image: url(image.png); background-repeat: no-repeat")
but it is not working. I'm getting “could not parse stylesheet” error. Obviously, image is in the same direction as code.
Also, when I set only only background image it displays
"shadow"
Do you know how to fix these problems? Thanks
There are two problems:
;}
at the end of the background, which makes the stylesheet invalid;*
"universal selector (which is almost the same as using QWidget
) means that all widgets will use the properties declared for it, and since you're probably setting the stylesheet on a QMainWindow (which inherits from QWidget), the image background is shown for both the main window and its central widget; the universal selector should be used with care, and especially avoided for top level widgets;So, besides fixing the typo, you should apply the background only for the widget you're interested into. A good solution could be to set the object name of the central widget (if it's not already set, for instance when using a Designer file) and use the appropriate selector in the stylesheet. I also recommend you to use better format and indentation on stylesheets, as it will makes them more readable, allowing you to find syntax errors more easily.
self.window.centralWidget().setObjectName('centralWidget')
self.window.setStyleSheet('''
QWidget#centralWidget {
color: qlineargradient(spread:pad, x1:0 y1:0, x2:1 y2:0,
stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));
background: qlineargradient(x1:0 y1:0, x2:1 y2:0,
stop:0 #ffc982, stop:1 #ff9982);
background-image: url(image.png);
background-repeat: no-repeat;
}''')
I have three table 1)allcasefileofuserrequest 2)allscanfileofuserrequest 3)userrequestforcasecopies
Want to improve this question? Add details and clarify the problem by editing this post
The problem I'm facing is that I cannot create any new releases on any of the Google Play release tracks (internal, alpha, beta, production) since one of the old releases required location permissons
I have a csv file with AD users and their accountExpires attributeThe accountExpires values are currently in human readable format, but I want to convert it into 18-digit LDAP format so that I can import the file to change the date