Added more contribs from Lorne White, and updated some of the existing ones.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11553 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-09-04 04:17:38 +00:00
parent ddcb3d8378
commit 53fe40bac2
12 changed files with 1506 additions and 65 deletions

View File

@@ -17,30 +17,37 @@ from wxPython.wx import *
# 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()