Skip to content

iconify does not work with the PyQT5 #2

@alexfdo

Description

@alexfdo

Working code:

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
import iconify as ico


class Window(QtWidgets.QWidget):
    def __init__(self, parent=None):
        super().__init__()
        layout = QtWidgets.QVBoxLayout(self)
        button = QtWidgets.QPushButton('OK')
        # icon = ico.Icon('delete', color=QtGui.QColor('blue'))
        # button.setIcon(icon)
        button.setIcon(QtGui.QIcon("resources/icons/eye.svg"))      # 1
        layout.addWidget(button)


if __name__ == "__main__":
    app = QtWidgets.QApplication([])
    w = Window()
    w.show()
    sys.exit(app.exec_())

But if I uncomment the two lines instead of the line with comment 1, I immediately get the following error:
TypeError: setIcon(self, QIcon): argument 1 has unexpected type 'PySide2.QtGui.QIcon'

I really liked the program, its ability to work with SVG directly and suddenly such OPS !!!
What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions