View Single Post
Old 07-20-2017, 10:15 AM   #178
College Benchwarmer
Join Date: Oct 2000
Location: calgary, AB
Originally Posted by Groundhog View Post
standard_button = '''QPushButton {{ color: rgb{}; background-color: rgb{}; border-bottom-left-radius: {}px; border-bottom-right-radius: {}px; border-top-left-radius: {}px; border-top-right-radius: {}px; }} QPushButton:hover {{ background-color: rgb{}; }} QPushButton:checked {{ background-color: rgb{}; color: rgb{}; }} QPushButton:disabled {{ color: rgb{}; background-color: rgb{}; border: none; }}'''

I can't remember if there's a good reason why I used individual corner radius %s vs just a general border-radius setting. Swap out the {} for values and that's straight out of my code.

I didn't use the setPalette or .setObjectName methods for any of my widgets - again, can't remember if that was for a reason or if I just never saw those methods. I created this library to let me group widgets and make it easier to manage colour schemes on different team pages, etc. It's super amateur and I'm sure Qt has a way of doing the same thing (possibly .setObjetcName), but it was an easier "python" way for me to handle it.

Weird, doing each corner separately seems to work. I think that you have to use the palette command if you're using PyQt5. Like how the QMainWindow moved from PyGui to QtWidgets.

One thing I'm going to have to work on is the ability to batch import. I've got it set up that I can read in constants from a text file for athlete generation, but I'm not sure how to do it to create a generic style sheet based on the country the player is using.

Maybe I'll actually post in my thread to discuss it better.
nilodor is offline   Reply With Quote