PySide QPushButton Color Change Not Working - 3ds Max 2017 Windows 10

PySide QPushButton Color Change Not Working - 3ds Max 2017 Windows 10

Huston94
Enthusiast Enthusiast
2,730 Views
6 Replies
Message 1 of 7

PySide QPushButton Color Change Not Working - 3ds Max 2017 Windows 10

Huston94
Enthusiast
Enthusiast

*** Colored text coordinates with image below to show whats going on. Sorry I know it may be harsh on the eyes. ***

 

Hi there,

 

I am building a UI with PySide in 3DS Max and something I really like doing is using color coding for easy/intuitive UI use. I recently tried to change the background color of some of the QPushButtons on my UI using the setStylesheet("background-color:rgb(110,208,110)") command in PySide. Any color I attempted to change it to just turned it very light grey (basically white).

 

That being said, it seems that changing the background color of most other kinds of UI element (Integer Field, Float Field, Text Field, Menu Box, etc) works fine. And changing any kind of text using setStylesheet("color:rgb(110,208,110)") works perfect too. So what is the deal with the the buttons? Is this a bug in the build of PySide that 3ds Max (2017) currently supports? Or am I doing something wrong? Thanks!

 

PySide Error.PNG

0 Likes
2,731 Views
6 Replies
Replies (6)
Message 2 of 7

denisT.MaxDoctor
Advisor
Advisor

try something like:

setStyleSheet('QPushButton {background:#505030; color: orange}')
0 Likes
Message 3 of 7

Huston94
Enthusiast
Enthusiast

You had me excited but unfortunately still not working... 😕

 

PySide Error.PNG

0 Likes
Message 4 of 7

denisT.MaxDoctor
Advisor
Advisor

could you show all code for UI creation? 

or 

do you use QtDesigner to make UI?

 

0 Likes
Message 5 of 7

Huston94
Enthusiast
Enthusiast

Sure. I've added it as an attachment due to it's length. Note: I removed all the other working files from the project since I figured you didn't need them so it may seem like the tool does nothing. lol

 

Feel free to give any other critiques on it that you may see. Thanks.

0 Likes
Message 6 of 7

Huston94
Enthusiast
Enthusiast

Has anything come of this? I'm noticing this issue in 2018 as well with PySide2. It's very odd. 

0 Likes
Message 7 of 7

malcomarmstrong
Advocate
Advocate

Just a quick note. Has it anything to do with the height of the text edit? If over 16px, it becomes a multi line box. Could that be a factor?

Have you tried: 

QTextedit.setBackgroundColor(QtGui.QColor(255, 255, 255, 70)) 

or similar?

 

I see that you have written the code. I know its a moot point, but this can all be set in Qtdesigner. For future reference. Admittedly, I prefer to code the whole thing, but QtDesigner can be helpful.

0 Likes