T
T
TomasHuk2015-10-29 11:36:18
Python
TomasHuk, 2015-10-29 11:36:18

Is it possible to include an external stylesheet for a PyQt4 application?

As you know, styles can be attached to individual elements in PyQt via setStyleSheet, similar to css.
For example:

self.button.setStyleSheet("font-size:40px;background-color:#333333;\
        border: 2px solid #222222")

This is done either in Qt Designer, or already in the .py file. It's all simple and clear.
There was a question which consists of two:
1 Is it possible to include an external style file directly in Qt Designer?
2 If this is not possible, then maybe there is a possibility to include the style file in the .py file?
I saw that it is possible to do this in C ++ (connecting an external .qss style file). Therefore, the question arose.
As a result, I want to take out the design of the application on PyQt in a separate file.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TomasHuk, 2015-11-04
@TomasHuk

Finally found a simple and working example - https://github.com/jangelo/pyqt-helloworld .
Normal window:
The same window with an external stylesheet attached:
0ce2de96813743128ec4d258010f72eb.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question