Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reading pyqt stylesheet from external qss file

I have made a qss file of pyqt stylsheet and how am i supposed to call the file content and fed to self.setStylesheet(..)

from PyQt4 import QtCore
s = QtCore.QString('c:\myProject\darkFantasy.stylesheet')

the above code loads the path string rather than the actual stylesheet.

So how do I load the actual content of the stylesheet file..? should I read it using the open file in read mode ?

like image 690
Ciasto piekarz Avatar asked Jan 24 '13 17:01

Ciasto piekarz


1 Answers

alright figured out the answer myself I hope it helps everyone:

sshFile="darkorange.stylesheet"
with open(sshFile,"r") as fh:
    self.setStyleSheet(fh.read())
like image 133
Ciasto piekarz Avatar answered Oct 02 '22 20:10

Ciasto piekarz