Python wx.ColourDialog() Examples

The following are 9 code examples of wx.ColourDialog(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: wm_frame.py    From wafer_map with GNU General Public License v3.0 6 votes vote down vote up
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! 
Example #2
Source File: ColourSelectButton.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
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) 
Example #3
Source File: cfgdlg.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
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() 
Example #4
Source File: core.py    From wafer_map with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #5
Source File: wm_frame.py    From wafer_map with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #6
Source File: chooser.py    From Gooey with MIT License 5 votes vote down vote up
def getDialog(self):
        return wx.ColourDialog(self) 
Example #7
Source File: params.py    From admin4 with Apache License 2.0 5 votes vote down vote up
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 
Example #8
Source File: displayDialog.py    From Zulu with GNU Affero General Public License v3.0 5 votes vote down vote up
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() 
Example #9
Source File: displayDialog.py    From Zulu with GNU Affero General Public License v3.0 5 votes vote down vote up
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()