# GetColour method to get the selected colour
class ColourSelect(wxButton):
- def __init__(self, parent, id, bcolour=(0, 0, 0), pos=wxDefaultPosition, size=wxDefaultSize):
- wxButton.__init__(self, parent, id, "", pos=pos, size=size)
- EVT_BUTTON(parent, self.GetId(), self.OnClick)
- self.SetForegroundColour(wxWHITE)
- self.SetColour(bcolour)
+ def __init__(self, parent, position = wxPoint(20, 20), bcolour = [0, 0, 0], size = wxSize(20, 20)):
+ self.win = parent
+ mID = NewId()
+ self.b = b = wxButton(parent, mID, "", position, size)
+ EVT_BUTTON(parent, mID, self.OnClick)
- def SetColour(self, bcolour):
self.set_colour_val = set_colour = wxColor(bcolour[0], bcolour[1], bcolour[2])
- self.SetBackgroundColour(set_colour)
+ b.SetBackgroundColour(set_colour)
+ b.SetForegroundColour(wxWHITE)
self.set_colour = bcolour
+ def SetColour(self, bcolour):
+ self.b.SetBackgroundColour(bcolour)
def GetColour(self):
return self.set_colour
-
def OnClick(self, event):
data = wxColourData()
data.SetChooseFull(true)
data.SetColour(self.set_colour_val)
- dlg = wxColourDialog(self.GetParent(), data)
+ dlg = wxColourDialog(self.win, data)
if dlg.ShowModal() == wxID_OK:
data = dlg.GetColourData()
- self.SetColour(data.GetColour().Get())
+ self.set_colour = set = data.GetColour().Get()
+ self.set_colour_val = bcolour = wxColour(set[0],set[1],set[2])
+ self.b.SetBackgroundColour(bcolour)
dlg.Destroy()
+
+
+
+