(self, parent, initialColor, name, mask, labelSize)
Initializes the paint color, the mask color (cyan, magenta, or
        yellow), connects the color selector and invert checkbox to functions,
        and creates a two-by-two grid layout.
Initializes the paint color, the mask color (cyan, magenta, or
        yellow), connects the color selector and invert checkbox to functions,
        and creates a two-by-two grid layout.
Initializes the paint color the mask color ( cyan magenta or yellow ) connects the color selector and invert checkbox to functions and creates a two - by - two grid layout .
def __init__(self, parent, initialColor, name, mask, labelSize):
        """ Initializes the paint color, the mask color (cyan, magenta, or
        yellow), connects the color selector and invert checkbox to functions,
        and creates a two-by-two grid layout.
        """
        super(ScreenWidget, self).__init__(parent)

        self.originalImage = QImage()
        self.newImage = QImage()

        self.paintColor = initialColor
        self.maskColor = mask
        self.inverted = False

        self.imageLabel = QLabel()
        self.imageLabel.setFrameShadow(QFrame.Sunken)
        self.imageLabel.setFrameShape(QFrame.StyledPanel)
        self.imageLabel.setMinimumSize(labelSize)

        self.nameLabel = QLabel(name)
        self.colorButton = QPushButton("Modify...")
        self.colorButton.setBackgroundRole(QPalette.Button)
        self.colorButton.setMinimumSize(32, 32)

        palette = QPalette(self.colorButton.palette())
        palette.setColor(QPalette.Button, initialColor)
        self.colorButton.setPalette(palette)

        self.invertButton = QPushButton("Invert")
        self.invertButton.setEnabled(False)

        self.colorButton.clicked.connect(self.setColor)
        self.invertButton.clicked.connect(self.invertImage)

        gridLayout = QGridLayout()
        gridLayout.addWidget(self.imageLabel, 0, 0, 1, 2)
        gridLayout.addWidget(self.nameLabel, 1, 0)
        gridLayout.addWidget(self.colorButton, 1, 1)
        gridLayout.addWidget(self.invertButton, 2, 1, 1, 1)
        self.setLayout(gridLayout)
def __init__ ( self , parent , initialColor , name , mask , labelSize ) : super ( ScreenWidget , self ) . __init__ ( parent ) self . originalImage = QImage ( ) self . newImage = QImage ( ) self . paintColor = initialColor self . maskColor = mask self . inverted = False self . imageLabel = QLabel ( ) self . imageLabel . setFrameShadow ( QFrame . Sunken ) self . imageLabel . setFrameShape ( QFrame . StyledPanel ) self . imageLabel . setMinimumSize ( labelSize ) self . nameLabel = QLabel ( name ) self . colorButton = QPushButton ( "Modify..." ) self . colorButton . setBackgroundRole ( QPalette . Button ) self . colorButton . setMinimumSize ( 32 , 32 ) palette = QPalette ( self . colorButton . palette ( ) ) palette . setColor ( QPalette . Button , initialColor ) self . colorButton . setPalette ( palette ) self . invertButton = QPushButton ( "Invert" ) self . invertButton . setEnabled ( False ) self . colorButton . clicked . connect ( self . setColor ) self . invertButton . clicked . connect ( self . invertImage ) gridLayout = QGridLayout ( ) gridLayout . addWidget ( self . imageLabel , 0 , 0 , 1 , 2 ) gridLayout . addWidget ( self . nameLabel , 1 , 0 ) gridLayout . addWidget ( self . colorButton , 1 , 1 ) gridLayout . addWidget ( self . invertButton , 2 , 1 , 1 , 1 ) self . setLayout ( gridLayout )