The signal you are requesting is colorSelected
, this is issued after pressing the OK button
class Widget(QWidget):
def __init__(self, *args, **kwargs):
QWidget.__init__(self, *args, **kwargs)
self.color_chooser = QColorDialog()
self.color_chooser.colorSelected.connect(self.color_pick)
self.color_chooser.show()
def color_pick(self, color):
print('signaled', color)
If you want to get the color after pressing the OK button you can use these other methods:
class Widget(QWidget):
def __init__(self, *args, **kwargs):
QWidget.__init__(self, *args, **kwargs)
self.color_chooser = QColorDialog()
if self.color_chooser.exec_() == QColorDialog.Accepted:
print(self.color_chooser.currentColor())
class Widget(QWidget):
def __init__(self, *args, **kwargs):
QWidget.__init__(self, *args, **kwargs)
self.color_chooser = QColorDialog()
color = self.color_chooser.getColor()
if color.isValid():
print(color, color.name())