I have a PyQt user interface as follows
import sys
from PyQt4 import QtGui
class Example(QtGui.QMainWindow):
def __init__(self, parent=None):
super(Example, self).__init__(parent)
self.setWindowTitle('Example')
self.setWindowIcon(QtGui.QIcon('note_add.svg'))
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
ex.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
It works fine on Linux but it doesn't work well on Windows, because the SVG icon doesn't appear. I have two questions:
- What is the proper way to use SVG icons with PyQt on Windows?
- Is there a way to change the color fill of an SVG icon on the fly? This should work fine on both operating systems.
I know this is a few years late. But, better late than never. :)
For me, Qt works best when I define a specific directory. So, I'd implement this as so: