Profile Picture

Python Class: Color Picker Dialog

Posted By jlittle 5 Years Ago
You don't have permission to rate!
Author
Message
jlittle
jlittle
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (6.7K reputation)Distinguished Member (6.7K reputation)Distinguished Member (6.7K reputation)Distinguished Member (6.7K reputation)Distinguished Member (6.7K reputation)Distinguished Member (6.7K reputation)Distinguished Member (6.7K reputation)Distinguished Member (6.7K reputation)Distinguished Member (6.7K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 1.9K, Visits: 17.1K
Here I've attached a module with the same ColorPickerDialog but as a class.
Usage would be as follows:
import PickColorDialogClass

# 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:
# get current color
currClr = QColor.fromRgb(0,255,0,255)
# show dialog, using current color, and return color or None if cancelled
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.

Jeff



Get my Plugin Manager and TaskNotes plugins for iClone.
Check out EZColors and Other products for CTA/CA. EZColors: the easy way to change Render Styled (RS) colors!
See my CTA Tutorials on the YouTube channel CTAStepByStep

Edited
5 Years Ago by jlittle



Reading This Topic