[PyQt] Importing Css file

uahmed gleam.uahmed at gmail.com
Tue Nov 29 15:11:38 GMT 2011


Hi ,

I want to include a css file to pyqt application , i wrote the following
code , but it is not effecting the properties of label

my python code is this

#!/usr/bin/python
import os ,sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
file_path = QString("css_file.qss")
app =QApplication(sys.argv)
label =QLabel("message")
label.setStyleSheet(file_path)
label.show()
app.exec_()

and "css_file.qss" containing this text

.QLabel {
font-weight: bold;
font-size: 15px;
color : green;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20111129/1e98425a/attachment.html>


More information about the PyQt mailing list