Python wx.Colour() Examples
The following are 30
code examples of wx.Colour().
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: FrameAndPanelApp.py From advancedpython3 with GNU General Public License v3.0 | 7 votes |
def __init__(self): super().__init__(parent=None, title='Sample App', size=(300, 300)) # Set up the first Panel to be at position 1, 1 # and of size 300 by 100 with a blue background self.panel1 = wx.Panel(self) self.panel1.SetSize(300, 100) self.panel1.SetBackgroundColour(wx.Colour(0, 0, 255)) # Set up the second Panel to be at position 1, 110 # and of size 300 by 100 with a red background self.panel2 = wx.Panel(self) self.panel2.SetSize(1, 110, 300, 100) self.panel2.SetBackgroundColour(wx.Colour(255, 0, 0))
Example #2
Source File: stockLevelsPanel.py From HH---POS-Accounting-and-ERP-Software with MIT License | 6 votes |
def updateStocks (self): self.m_productsGrid.DeleteRows(numRows=self.m_productsGrid.GetNumberRows()) p = self.populateTable() lenP = len(p) self.m_productsGrid.InsertRows(numRows=lenP) # Populate Table row = 0 for x in p: col = 0 x = list(x.values()) if float(x[5]) > float(x[6]): self.m_productsGrid.SetCellBackgroundColour(row, 6, wx.Colour(255, 128, 128)) for y in x: self.m_productsGrid.SetCellValue(row, col, str(y)) col = col + 1 row = row + 1
Example #3
Source File: backend_wx.py From ImageFusion with MIT License | 6 votes |
def get_wxcolour(self, color): """return a wx.Colour from RGB format""" DEBUG_MSG("get_wx_color()", 1, self) if len(color) == 3: r, g, b = color r *= 255 g *= 255 b *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b)) else: r, g, b, a = color r *= 255 g *= 255 b *= 255 a *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b), alpha=int(a))
Example #4
Source File: matplotlib_eg.py From tensorlang with Apache License 2.0 | 6 votes |
def __init__(self): wx.Frame.__init__(self, None, -1, 'CanvasFrame', size=(550, 350)) if sys.version_info[0] == 3: color = wx.Colour("WHITE") else: color = wx.NamedColour("WHITE") self.SetBackgroundColour(color) self.figure = Figure() self.axes = self.figure.add_subplot(111) t = arange(0.0, 3.0, 0.01) s = sin(2 * pi * t) self.axes.plot(t, s) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizerAndFit(self.sizer) self.add_toolbar()
Example #5
Source File: wm_frame.py From wafer_map with GNU General Public License v3.0 | 6 votes |
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 #6
Source File: wm_legend.py From wafer_map with GNU General Public License v3.0 | 6 votes |
def draw_background(self): """ Draw the background box. If I don't do this, then the background is black. Could I change wx.EmptyBitmap() so that it defaults to white rather than black? """ # TODO: change the bitmap background to be transparent c = wx.Colour(200, 230, 230, 0) c = wx.Colour(255, 255, 255, 0) pen = wx.Pen(c) brush = wx.Brush(c) self.mdc.SetPen(pen) self.mdc.SetBrush(brush) self.mdc.DrawRectangle(0, 0, self.dc_w, self.dc_h)
Example #7
Source File: core.py From wafer_map with GNU General Public License v3.0 | 6 votes |
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
Example #8
Source File: uicore.py From NXP-MCUBootFlasher with Apache License 2.0 | 6 votes |
def updateConnectStatus( self, color='black' ): self.connectStatusColor = color if color == 'black': self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_black'][self.languageIndex]) self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0x80, 0x80, 0x80 ) ) elif color == 'yellow': self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_yellow'][self.languageIndex]) self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0xff, 0xff, 0x80 ) ) elif color == 'green': self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_green'][self.languageIndex]) self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0x80, 0xff, 0x80 ) ) elif color == 'blue': self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_blue'][self.languageIndex]) self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0x00, 0x80, 0xff ) ) elif color == 'red': self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_red'][self.languageIndex]) self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0xff, 0x80, 0x80 ) ) else: pass
Example #9
Source File: window_dialog.py From wxGlade with MIT License | 6 votes |
def on_text(self, event): import re validation_re = re.compile(r'^[a-zA-Z_]+[\w:.0-9-]*$') name = event.GetString() OK = bool( validation_re.match( name ) ) if not OK: self.klass.SetBackgroundColour(wx.RED) compat.SetToolTip(self.klass, "Class name not valid") else: #if name in [c.widget.klass for c in common.root.children or []]: if self.toplevel and name in self.toplevel_names: self.klass.SetBackgroundColour( wx.RED ) compat.SetToolTip(self.klass, "Class name already in use for toplevel window") OK = False elif name in self.class_names: # if the class name is in use already, indicate in yellow self.klass.SetBackgroundColour( wx.Colour(255, 255, 0, 255) ) compat.SetToolTip(self.klass, "Class name not unique") if self.toplevel and name in self.toplevel_names: OK = False else: self.klass.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) ) compat.SetToolTip(self.klass, "") self.klass.Refresh() self.btnOK.Enable(OK) event.Skip()
Example #10
Source File: backend_wx.py From Computable with MIT License | 6 votes |
def get_wxcolour(self, color): """return a wx.Colour from RGB format""" DEBUG_MSG("get_wx_color()", 1, self) if len(color) == 3: r, g, b = color r *= 255 g *= 255 b *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b)) else: r, g, b, a = color r *= 255 g *= 255 b *= 255 a *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b), alpha=int(a))
Example #11
Source File: backend_wx.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def get_wxcolour(self, color): """return a wx.Colour from RGB format""" DEBUG_MSG("get_wx_color()", 1, self) if len(color) == 3: r, g, b = color r *= 255 g *= 255 b *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b)) else: r, g, b, a = color r *= 255 g *= 255 b *= 255 a *= 255 return wx.Colour( red=int(r), green=int(g), blue=int(b), alpha=int(a))
Example #12
Source File: richtextconsole.py From Gooey with MIT License | 6 votes |
def __init__(self, parent): super(wx.richtext.RichTextCtrl, self).__init__(parent, -1, "", style=wx.richtext.RE_MULTILINE | wx.richtext.RE_READONLY) self.regex_urls=re.compile(r'\b((?:file://|https?://|mailto:)[^][\s<>|]*)') self.url_colour = wx.Colour(0,0,255) self.esc = colored.style.ESC self.end = colored.style.END self.noop = lambda *args, **kwargs: None self.actionsMap = { colored.style.BOLD: self.BeginBold, colored.style.RES_BOLD: self.EndBold, colored.style.UNDERLINED: self.BeginUnderline, colored.style.RES_UNDERLINED: self.EndUnderline, colored.style.RESET: self.EndAllStyles, } # Actions for coloring text for index, hex in enumerate(kColorList): escSeq = '{}{}{}'.format(colored.fore.ESC, index, colored.fore.END) wxcolor = wx.Colour(int(hex[1:3],16), int(hex[3:5],16), int(hex[5:],16), alpha=wx.ALPHA_OPAQUE) # NB : we use a default parameter to force the evaluation of the binding self.actionsMap[escSeq] = lambda bindedColor=wxcolor: self.BeginTextColour(bindedColor)
Example #13
Source File: backend_wx.py From matplotlib-4-abaqus with MIT License | 6 votes |
def get_wxcolour(self, color): """return a wx.Colour from RGB format""" DEBUG_MSG("get_wx_color()", 1, self) if len(color) == 3: r, g, b = color r *= 255 g *= 255 b *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b)) else: r, g, b, a = color r *= 255 g *= 255 b *= 255 a *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b), alpha=int(a))
Example #14
Source File: backend_wx.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def get_wxcolour(self, color): """return a wx.Colour from RGB format""" DEBUG_MSG("get_wx_color()", 1, self) if len(color) == 3: r, g, b = color r *= 255 g *= 255 b *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b)) else: r, g, b, a = color r *= 255 g *= 255 b *= 255 a *= 255 return wx.Colour( red=int(r), green=int(g), blue=int(b), alpha=int(a))
Example #15
Source File: invoiceInfoPanel.py From HH---POS-Accounting-and-ERP-Software with MIT License | 6 votes |
def updateInvoices (self): if self.m_invoiceGrid.GetNumberRows() > 0: self.m_invoiceGrid.DeleteRows(numRows=self.m_invoiceGrid.GetNumberRows()) p = self.populateTable() lenP = len(p) self.m_invoiceGrid.InsertRows(numRows=lenP) # Populate Table col=0 for x in p: row=0 x = list(x.values()) if float(x[3]) < float(x[4]): self.m_invoiceGrid.SetCellBackgroundColour(row, 4, wx.Colour(255, 128, 128)) for y in x: self.m_invoiceGrid.SetCellValue(col, row, str(y)) row = row+1 col = col+1
Example #16
Source File: quoteInfoPanel.py From HH---POS-Accounting-and-ERP-Software with MIT License | 6 votes |
def updateQuotes (self): self.m_quoteInfoGrid.DeleteRows(numRows=self.m_quoteInfoGrid.GetNumberRows()) p = self.populateTable() lenP = len(p) self.m_quoteInfoGrid.InsertRows(numRows=lenP) # Populate Table col=0 for x in p: row=0 x = list(x.values()) #if float(x[3]) > float(x[4]): #print((x, row)) #self.m_quoteInfoGrid.SetCellBackgroundColour(x[0], 4, wx.Colour(255, 128, 128)) for y in x: self.m_quoteInfoGrid.SetCellValue(col, row, str(y)) row = row+1 col = col+1
Example #17
Source File: purchaseInfoPanel.py From HH---POS-Accounting-and-ERP-Software with MIT License | 6 votes |
def updatePurchases (self): self.m_purchaseGrid.DeleteRows(numRows=self.m_purchaseGrid.GetNumberRows()) p = self.populateTable() lenP = len(p) self.m_purchaseGrid.InsertRows(numRows=lenP) # Populate Table row=0 for x in p: col=0 x = list(x.values()) if x[2] > x[3]: self.m_purchaseGrid.SetCellBackgroundColour(row, 3, wx.Colour(255, 128, 128)) for y in x: self.m_purchaseGrid.SetCellValue(row, col, str(y)) col = col+1 row = row+1
Example #18
Source File: meliaeadapter.py From pyFileFixity with MIT License | 6 votes |
def background_color(self, node, depth): """Create a (unique-ish) background color for each node""" if self.color_mapping is None: self.color_mapping = {} if node['type'] == 'type': key = node['name'] else: key = node['type'] color = self.color_mapping.get(key) if color is None: depth = len(self.color_mapping) red = (depth * 10) % 255 green = 200 - ((depth * 5) % 200) blue = (depth * 25) % 200 self.color_mapping[key] = color = wx.Colour(red, green, blue) return color
Example #19
Source File: invoiceInfoPanel.py From HH---POS-Accounting-and-ERP-Software with MIT License | 6 votes |
def updateInvoices (self): if self.m_invoiceGrid.GetNumberRows() > 0: self.m_invoiceGrid.DeleteRows(numRows=self.m_invoiceGrid.GetNumberRows()) p = self.populateTable() lenP = len(p) self.m_invoiceGrid.InsertRows(numRows=lenP) # Populate Table row=0 for x in p: col=0 x = list(x.values()) if float(x[3]) > float(x[4]): self.m_invoiceGrid.SetCellBackgroundColour(row, 4, wx.Colour(255, 128, 128)) for y in x: self.m_invoiceGrid.SetCellValue(row, col, str(y)) col = col+1 row = row+1 #
Example #20
Source File: gui.py From superpaper with MIT License | 6 votes |
def draw_monitor_sizes(self): font = wx.Font(24, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_LIGHT) font_clr = wx.Colour(60, 60, 60, alpha=wx.ALPHA_OPAQUE) for st_bmp, img_sz, dsp in zip(self.preview_img_list, self.img_rel_sizes, self.display_sys.disp_list): bmp = st_bmp.GetBitmap() dc = wx.MemoryDC(bmp) text = str(dsp.diagonal_size()[1]) + '"' dc.SetTextForeground(font_clr) dc.SetFont(font) # bmp_w, bmp_h = dc.GetSize() bmp_w, bmp_h = img_sz text_w, text_h = dc.GetTextExtent(text) pos_w = bmp_w - text_w - 5 pos_h = 5 dc.DrawText(text, pos_w, pos_h) del dc st_bmp.SetBitmap(bmp)
Example #21
Source File: gui.py From superpaper with MIT License | 6 votes |
def draw_monitor_numbers(self, use_ppi_px): font = wx.Font(24, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) font_clr = wx.Colour(60, 60, 60, alpha=wx.ALPHA_OPAQUE) for st_bmp in self.preview_img_list: bmp = st_bmp.GetBitmap() dc = wx.MemoryDC(bmp) text = str(self.preview_img_list.index(st_bmp)) dc.SetTextForeground(font_clr) dc.SetFont(font) dc.DrawText(text, 5, 5) del dc st_bmp.SetBitmap(bmp) if use_ppi_px: self.draw_monitor_sizes()
Example #22
Source File: quoteInfoPanel.py From HH---POS-Accounting-and-ERP-Software with MIT License | 6 votes |
def updateQuotes (self): self.m_quoteInfoGrid.DeleteRows(numRows=self.m_quoteInfoGrid.GetNumberRows()) p = self.populateTable() lenP = len(p) self.m_quoteInfoGrid.InsertRows(numRows=lenP) # Populate Table col=0 for x in p: row=0 x = list(x.values()) #if float(x[3]) > float(x[4]): #print((x, row)) #self.m_quoteInfoGrid.SetCellBackgroundColour(x[0], 4, wx.Colour(255, 128, 128)) for y in x: self.m_quoteInfoGrid.SetCellValue(col, row, str(y)) row = row+1 col = col+1
Example #23
Source File: backend_wx.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def get_wxcolour(self, color): """return a wx.Colour from RGB format""" DEBUG_MSG("get_wx_color()", 1, self) if len(color) == 3: r, g, b = color r *= 255 g *= 255 b *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b)) else: r, g, b, a = color r *= 255 g *= 255 b *= 255 a *= 255 return wx.Colour( red=int(r), green=int(g), blue=int(b), alpha=int(a))
Example #24
Source File: purchaseInfoPanel.py From HH---POS-Accounting-and-ERP-Software with MIT License | 6 votes |
def updatePurchases (self): self.m_purchaseGrid.DeleteRows(numRows=self.m_purchaseGrid.GetNumberRows()) p = self.populateTable() lenP = len(p) self.m_purchaseGrid.InsertRows(numRows=lenP) # Populate Table col=0 for x in p: row=0 x = list(x.values()) if x[3] > x[4]: self.m_purchaseGrid.SetCellBackgroundColour(row, 4, wx.Colour(255, 128, 128)) for y in x: self.m_purchaseGrid.SetCellValue(col, row, str(y)) row = row+1 col = col+1
Example #25
Source File: backend_wx.py From neural-network-animation with MIT License | 6 votes |
def get_wxcolour(self, color): """return a wx.Colour from RGB format""" DEBUG_MSG("get_wx_color()", 1, self) if len(color) == 3: r, g, b = color r *= 255 g *= 255 b *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b)) else: r, g, b, a = color r *= 255 g *= 255 b *= 255 a *= 255 return wx.Colour(red=int(r), green=int(g), blue=int(b), alpha=int(a))
Example #26
Source File: purchaseInfoPanel.py From HH---POS-Accounting-and-ERP-Software with MIT License | 5 votes |
def searchInput(self, event): v = self.search.GetValue() if v == "": self.updatePurchases() return if self.m_purchaseGrid.GetNumberRows() > 0: self.m_purchaseGrid.DeleteRows(numRows=self.m_purchaseGrid.GetNumberRows()) qry = 'SELECT DISTINCT p.id, p.dateTime, p.totalBill, p.amountPaid, s.id, s.name, s.contact FROM purchase p, supplier s where s.id=p.supplier and ( p.id LIKE "%'+v+'%" OR p.dateTime LIKE "%'+v+'%" OR p.totalBill LIKE "%'+v+'%" OR p.amountPaid LIKE "%'+v+'%" OR s.id LIKE "%'+v+'%" OR s.name LIKE "%'+v+'%" OR s.contact LIKE "%'+v+'%") ORDER BY p.id DESC' con = connectToDB() curs = con.cursor() curs.execute(qry) p = [] while (1): r = curs.fetchone() if (r is not None): p.append(r) else: break lenP = len(p) self.m_purchaseGrid.InsertRows(numRows=lenP) # Populate Table row = 0 for x in p: col = 0 x = list(x.values()) if x[2] > x[3]: self.m_purchaseGrid.SetCellBackgroundColour(row, 3, wx.Colour(255, 128, 128)) for y in x: self.m_purchaseGrid.SetCellValue(row, col, str(y)) col = col + 1 row = row + 1
Example #27
Source File: edit_windows.py From wxGlade with MIT License | 5 votes |
def update_label(self): if not self.owner.widget or not self.owner.is_visible(): label = _('Show Design Window') self.background_color = wx.Colour(150,150,240) # make button more visible else: label = _('Hide Design Window') self.background_color = compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE) self.set_label(label)
Example #28
Source File: misc.py From wxGlade with MIT License | 5 votes |
def string_to_color(color): "Hex string to wxColour instance; e.g. string_to_color('#ffffff') -> wx.Colour(255, 255, 255)" if len(color)==7: return wx.Colour( *[int(color[i:i + 2], 16) for i in range(1, 7, 2)] ) if len(color)==9: return wx.Colour( *[int(color[i:i + 2], 16) for i in range(1, 9, 2)] ) raise ValueError
Example #29
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def _on_text(self, event): if self.deactivated or self.blocked: return name = event.GetString() match = self.validation_re.match(name) if match: if self._check_name_uniqueness(name): self.text.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) ) else: self.text.SetBackgroundColour( wx.Colour(255, 255, 0, 255) ) # YELLOW else: self.text.SetBackgroundColour(wx.RED) self.text.Refresh() event.Skip()
Example #30
Source File: customerInfoPanel.py From HH---POS-Accounting-and-ERP-Software with MIT License | 5 votes |
def searchInput(self, event): v = self.search.GetValue() if v == "": self.updateCustomers() return if self.m_custInfoGrid.GetNumberRows() > 0: self.m_custInfoGrid.DeleteRows(numRows=self.m_custInfoGrid.GetNumberRows()) qry = 'select c.id, c.name, c.contact, c.address from customer c where c.id LIKE "%'+v+'%" OR c.name LIKE "%'+v+'%" OR c.contact LIKE "%'+v+'%" OR c.address LIKE "%'+v+'%" ORDER BY c.id' con = connectToDB() curs = con.cursor() curs.execute(qry) p = [] while (1): r = curs.fetchone() if (r is not None): p.append(r) else: break lenP = len(p) self.m_custInfoGrid.InsertRows(numRows=lenP) # Populate Table col=0 for x in p: row=0 x = list(x.values()) #if float(x[3]) > float(x[4]): # self.m_custInfoGrid.SetCellBackgroundColour(x[0], 4, wx.Colour(255, 128, 128)) for y in x: self.m_custInfoGrid.SetCellValue(col, row, str(y)) row = row+1 col = col+1