def _calculate(self): '''Create a brush for showing the new hue.''' self.color = wx_tools.hls_to_wx_color( (self.hue, self.hue_selection_dialog.lightness, self.hue_selection_dialog.saturation) ) self.brush = wx.Brush(self.color)
def on_paint(self, event): dc = wx.PaintDC(self) color = wx_tools.hls_to_wx_color( ( self.getter(), self.lightness, self.saturation ) ) dc.SetBrush(wx.Brush(color)) dc.SetPen(self._pen) width, height = self.GetSize() dc.DrawRectangle(-5, -5, width+10, height+10)
def __init__(self, hue_selection_dialog): style = wx.SIMPLE_BORDER if wx.Platform == '__WXGTK__' else \ wx.SUNKEN_BORDER wx.Panel.__init__(self, parent=hue_selection_dialog, size=(75, 90), style=style) self.SetDoubleBuffered(True) self.hue_selection_dialog = hue_selection_dialog self.hue = hue_selection_dialog.hue self.old_hls = hue_selection_dialog.old_hls self.old_hue = hue_selection_dialog.old_hue self.old_color = wx_tools.hls_to_wx_color(self.old_hls) self.old_brush = wx.Brush(self.old_color) self._pen = wx.Pen(wx.Colour(0, 0, 0), width=0, style=wx.TRANSPARENT) self._calculate() self.SetCursor(wx.StockCursor(wx.CURSOR_BULLSEYE)) self.Bind(wx.EVT_PAINT, self.on_paint) self.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_left_down)
def _calculate(self): '''Create a brush for showing the new hue.''' self.color = wx_tools.hls_to_wx_color( (self.hue, self.hue_selection_dialog.lightness, self.hue_selection_dialog.saturation)) self.brush = wx.Brush(self.color)