23 from PyQt5
import QtCore, QtWidgets, QtGui
28 colorChanged = QtCore.pyqtSignal()
30 def __init__(self, width, height, color, parent=None):
31 QtWidgets.QWidget.__init__(self, parent)
38 self.
color_color_ = QtWidgets.QColor(
"White")
45 self.
change_color_change_color_ = QtWidgets.QAction(
'ChangeColor', self)
50 self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
55 color = QtWidgets.QColorDialog.getColor(initial = self.
color_color_, parent = self,
56 title =
"Select Color")
58 if(color != self.
color_color_
and color.isValid()):
68 return gfx.RGB(color.redF(), color.greenF(), color.blueF())
71 if(self.
color_color_ != color):
77 qcolor= QtWidgets.QColor(color.Red()*255,color.Green()*255,color.Blue()*255,color.Alpha()*255)
83 paint = QtGui.QPainter()
85 brush = QtGui.QBrush(self.
color_color_)