本文整理匯總了Python中wx.ColourData方法的典型用法代碼示例。如果您正苦於以下問題:Python wx.ColourData方法的具體用法?Python wx.ColourData怎麽用?Python wx.ColourData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wx
的用法示例。
在下文中一共展示了wx.ColourData方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ColourData [as 別名]
def __init__(self, parent, id=-1, colour=wx.BLACK,
pos=wx.DefaultPosition, size=wx.DefaultSize,
style = CLRP_DEFAULT_STYLE,
validator = wx.DefaultValidator,
name = "colourpickerwidget"):
wx.BitmapButton.__init__(self, parent, id, wx.Bitmap(1,1),
pos, size, style, validator, name)
self.SetColour(colour)
self.InvalidateBestSize()
self.SetInitialSize(size)
self.Bind(wx.EVT_BUTTON, self.OnButtonClick)
global _colourData
if _colourData is None:
_colourData = wx.ColourData()
_colourData.SetChooseFull(True)
grey = 0
for i in range(16):
c = wx.Colour(grey, grey, grey)
_colourData.SetCustomColour(i, c)
grey += 16
示例2: OnButton
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ColourData [as 別名]
def OnButton(self, event):
colourData = wx.ColourData()
colourData.SetChooseFull(True)
colourData.SetColour(self.value)
for i, colour in enumerate(eg.config.colourPickerCustomColours):
colourData.SetCustomColour(i, colour)
dialog = wx.ColourDialog(self.GetParent(), colourData)
dialog.SetTitle(self.title)
if dialog.ShowModal() == wx.ID_OK:
colourData = dialog.GetColourData()
self.SetValue(colourData.GetColour().Get())
event.Skip()
eg.config.colourPickerCustomColours = [
colourData.GetCustomColour(i).Get() for i in range(16)
]
dialog.Destroy()
evt = eg.ValueChangedEvent(self.GetId(), value = self.value)
wx.PostEvent(self, evt)
示例3: __on_colour
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ColourData [as 別名]
def __on_colour(self, _event):
colourData = wx.ColourData()
colourData.SetChooseFull(True)
colourData.SetColour([level * 255 for level in self._colour])
for i in range(len(self._colours)):
colour = [level * 255 for level in self._colours[i]]
colourData.SetCustomColour(i, colour)
dlg = CubeColourDialog(self, colourData)
if dlg.ShowModal() == wx.ID_OK:
colour = dlg.GetColourData().GetColour()
colour = [level / 255. for level in colour]
self.set_colour(colour)
event = Event(Events.CHANGED)
post_event(self._eventHandler, event)
示例4: OnChangeColor
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ColourData [as 別名]
def OnChangeColor(self, event):
cd = wx.ColourData()
cd.SetColour(getattr(self.cfg, self.color).toWx())
dlg = wx.ColourDialog(self, cd)
dlg.SetTitle(self.colorsLb.GetStringSelection())
if dlg.ShowModal() == wx.ID_OK:
setattr(self.cfg, self.color,
util.MyColor.fromWx(dlg.GetColourData().GetColour()))
dlg.Destroy()
self.cfg2gui()
示例5: OnLeftDown
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ColourData [as 別名]
def OnLeftDown(self, evt):
data = wx.ColourData()
data.SetColour(self.GetValue())
dlg = wx.ColourDialog(self, data)
if dlg.ShowModal() == wx.ID_OK:
self.SetValue('#%02X%02X%02X' % dlg.GetColourData().GetColour().Get())
self.SetModified()
dlg.Destroy()
################################################################################
# Mapping from wx constants to XML strings