Here I've attached a module with the same ColorPickerDialog but as a class.
Usage would be as follows:
# create a PickColorDialog object
PickColor_Dlg = PickColorDialogClass.myPickColorDialog()
# show dialog and return color or None if cancelled
clr = PickColor_Dlg.getSelectedColor()
You can also set the initial color:
# show dialog, using current color, and return color or None if cancelled
# get current color currClr = QColor.fromRgb(0,255,0,255)
clr = PickColor_Dlg.getSelectedColor(currClr)
This does the same as the color picker dialog module except as a class.
A class is useful is you need to create multiple instances of the same object.
In this case you normally would not create multiple instances of a Color Dialog but only used it as an example to demonstrate how you can easily turn a module into a class.
See my CTA Tutorials on the YouTube channel CTAStepByStep
Check out EZColors for CTA. The easy way to change Render Styled (RS) colors.
3 Months Ago by