本文整理汇总了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