from PyQt.QtGui import QPushButton, QIcon # Create a push button widget button = QPushButton("Click me") # Create an icon and set it on the button icon = QIcon("my_icon.png") button.setIcon(icon)
from PyQt.QtGui import QComboBox, QIcon # Create a list of icon file paths icon_paths = ["icon1.png", "icon2.png", "icon3.png"] # Create a list of icons icons = [QIcon(path) for path in icon_paths] # Create a combo box widget and add the icons as options combo_box = QComboBox() for icon in icons: combo_box.addItem(icon, "Option with icon")These examples use the PyQt library which is a set of Python bindings for the Qt application framework.