本文整理汇总了Python中wx.ColourDialog方法的典型用法代码示例。如果您正苦于以下问题:Python wx.ColourDialog方法的具体用法?Python wx.ColourDialog怎么用?Python wx.ColourDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.ColourDialog方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_change_high_color
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ColourDialog [as 别名]
def on_change_high_color(self, event):
"""Change the high color and refresh display."""
print("High color menu item clicked!")
cd = wx.ColourDialog(self)
cd.GetColourData().SetChooseFull(True)
if cd.ShowModal() == wx.ID_OK:
new_color = cd.GetColourData().Colour
print("The color {} was chosen!".format(new_color))
self.panel.on_color_change({'high': new_color, 'low': None})
self.panel.Refresh()
else:
print("no color chosen :-(")
cd.Destroy()
# TODO: See the 'and' in the docstring? Means I need a separate method!
示例2: OnButton
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ColourDialog [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: OnChangeColor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ColourDialog [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()
示例4: OnButtonClick
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ColourDialog [as 别名]
def OnButtonClick(self, evt):
global _colourData
_colourData.SetColour(self.colour)
dlg = wx.ColourDialog(self, _colourData)
if dlg.ShowModal() == wx.ID_OK:
_colourData = dlg.GetColourData()
self.SetColour(_colourData.GetColour())
evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour())
self.GetEventHandler().ProcessEvent(evt)
示例5: on_change_low_color
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ColourDialog [as 别名]
def on_change_low_color(self, event):
"""Change the low color and refresh display."""
print("Low Color menu item clicked!")
cd = wx.ColourDialog(self)
cd.GetColourData().SetChooseFull(True)
if cd.ShowModal() == wx.ID_OK:
new_color = cd.GetColourData().Colour
print("The color {} was chosen!".format(new_color))
self.panel.on_color_change({'high': None, 'low': new_color})
self.panel.Refresh()
else:
print("no color chosen :-(")
cd.Destroy()
示例6: getDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ColourDialog [as 别名]
def getDialog(self):
return wx.ColourDialog(self)
示例7: OnLeftDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ColourDialog [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
示例8: onForecolor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ColourDialog [as 别名]
def onForecolor(self, event): # wxGlade: DisplayDialog.<event_handler>
dlg = wx.ColourDialog(self)
dlg.GetColourData().SetChooseFull(True)
dlg.GetColourData().SetColour(self.parent.settings.forecolor)
if dlg.ShowModal() == wx.ID_OK:
self.forecolor = dlg.GetColourData().GetColour().Get()
self.parent.settings.forecolor = self.forecolor
self.parent.updateTextctrl()
dlg.Destroy()
示例9: onBackcolor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ColourDialog [as 别名]
def onBackcolor(self, event): # wxGlade: DisplayDialog.<event_handler>
dlg = wx.ColourDialog(self)
dlg.GetColourData().SetChooseFull(True)
dlg.GetColourData().SetColour(self.parent.settings.backcolor)
if dlg.ShowModal() == wx.ID_OK:
self.backcolor = dlg.GetColourData().GetColour().Get()
self.parent.settings.backcolor = self.backcolor
self.parent.updateTextctrl()
dlg.Destroy()