Source code for pyvisor.GUI.icon_gallery.icon_button
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
[docs]
class IconButton(QPushButton):
def __init__(self, parent, path_to_icon, path_to_icon_template):
super(IconButton, self).__init__()
self.index_in_parent_list = None
self.setCheckable(True)
self.parent = parent
self.setFixedSize(*parent.icon_size)
self.setIcon(QIcon(path_to_icon))
self.setIconSize(QSize(*parent.icon_size))
self.path_to_icon = path_to_icon
self.path_to_icon_template = path_to_icon_template
self.toggled.connect(self.state_changed)
self.setStyleSheet("QPushButton:checked { background-color: black}")