from PySide2.QtGui import QIcon, QPixmap # create a QPixmap object from an image file pixmap = QPixmap('my_icon.png') # create a new QIcon object with the pixmap icon = QIcon() icon.addPixmap(pixmap) # use the icon in a widget, e.g. a QPushButton button = QPushButton() button.setIcon(icon)In this example, we first create a QPixmap object from an image file called 'my_icon.png'. Then, we create a new QIcon object and add the pixmap to it using the addPixmap() method. Finally, we set the icon of a QPushButton widget to our newly created icon using the setIcon() method. Overall, the PySide2.QtGui package library provides a powerful set of tools for creating beautiful and functional graphical user interfaces in Python.