Python wx.NamedColour() Examples
The following are 6
code examples of wx.NamedColour().
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: 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 #2
Source File: backend_wx.py From neural-network-animation with MIT License | 5 votes |
def draw_rubberband(self, event, x0, y0, x1, y1): # Use an Overlay to draw a rubberband-like bounding box. dc = wx.ClientDC(self.canvas) odc = wx.DCOverlay(self.wxoverlay, dc) odc.Clear() # Mac's DC is already the same as a GCDC, and it causes # problems with the overlay if we try to use an actual # wx.GCDC so don't try it. if 'wxMac' not in wx.PlatformInfo: dc = wx.GCDC(dc) height = self.canvas.figure.bbox.height y1 = height - y1 y0 = height - y0 if y1<y0: y0, y1 = y1, y0 if x1<y0: x0, x1 = x1, x0 w = x1 - x0 h = y1 - y0 rect = wx.Rect(x0, y0, w, h) rubberBandColor = '#C0C0FF' # or load from config? # Set a pen for the border color = wx.NamedColour(rubberBandColor) dc.SetPen(wx.Pen(color, 1)) # use the same color, plus alpha for the brush r, g, b = color.Get() color.Set(r,g,b, 0x60) dc.SetBrush(wx.Brush(color)) dc.DrawRectangleRect(rect)
Example #3
Source File: backend_wx.py From ImageFusion with MIT License | 5 votes |
def draw_rubberband(self, event, x0, y0, x1, y1): # Use an Overlay to draw a rubberband-like bounding box. dc = wx.ClientDC(self.canvas) odc = wx.DCOverlay(self.wxoverlay, dc) odc.Clear() # Mac's DC is already the same as a GCDC, and it causes # problems with the overlay if we try to use an actual # wx.GCDC so don't try it. if 'wxMac' not in wx.PlatformInfo: dc = wx.GCDC(dc) height = self.canvas.figure.bbox.height y1 = height - y1 y0 = height - y0 if y1<y0: y0, y1 = y1, y0 if x1<y0: x0, x1 = x1, x0 w = x1 - x0 h = y1 - y0 rect = wx.Rect(x0, y0, w, h) rubberBandColor = '#C0C0FF' # or load from config? # Set a pen for the border color = wx.NamedColour(rubberBandColor) dc.SetPen(wx.Pen(color, 1)) # use the same color, plus alpha for the brush r, g, b = color.Get() color.Set(r,g,b, 0x60) dc.SetBrush(wx.Brush(color)) dc.DrawRectangleRect(rect)
Example #4
Source File: LogViewer.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def Draw(self, dc): dc.SetPen(wx.TRANSPARENT_PEN) dc.SetBrush(wx.Brush(wx.NamedColour("LIGHT GREY"))) dc.DrawRectangle(self.Position.x, self.Position.y, self.Size.width, self.Size.height) w, h = dc.GetTextExtent(self.Label) dc.DrawText(self.Label, self.Position.x + (self.Size.width - w) // 2, self.Position.y + (self.Size.height - h) // 2)
Example #5
Source File: Notebook_Test.py From topoflow with MIT License | 4 votes |
def __init__(self, parent, id, log): wx.Notebook.__init__(self, parent, id, size=(21,21), style= wx.BK_DEFAULT #wx.BK_TOP #wx.BK_BOTTOM #wx.BK_LEFT #wx.BK_RIGHT # | wx.NB_MULTILINE ) self.log = log win = self.makeColorPanel(wx.BLUE) self.AddPage(win, "Blue") st = wx.StaticText(win.win, -1, "You can put nearly any type of window here,\n" "and if the platform supports it then the\n" "tabs can be on any side of the notebook.", (10, 10)) st.SetForegroundColour(wx.WHITE) st.SetBackgroundColour(wx.BLUE) # Show how to put an image on one of the notebook tabs, # first make the image list: il = wx.ImageList(16, 16) idx1 = il.Add(images.getSmilesBitmap()) self.AssignImageList(il) # now put an image on the first tab we just created: self.SetPageImage(0, idx1) win = self.makeColorPanel(wx.RED) self.AddPage(win, "Red") win = ScrolledWindow.MyCanvas(self) self.AddPage(win, 'ScrolledWindow') win = self.makeColorPanel(wx.GREEN) self.AddPage(win, "Green") win = GridSimple.SimpleGrid(self, log) self.AddPage(win, "Grid") win = ListCtrl.TestListCtrlPanel(self, log) self.AddPage(win, 'List') win = self.makeColorPanel(wx.CYAN) self.AddPage(win, "Cyan") win = self.makeColorPanel(wx.NamedColour('Midnight Blue')) self.AddPage(win, "Midnight Blue") win = self.makeColorPanel(wx.NamedColour('Indian Red')) self.AddPage(win, "Indian Red") self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging)
Example #6
Source File: LogViewer.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
def OnPaint(self, event): dc = wx.BufferedPaintDC(self) dc.Clear() dc.BeginDrawing() gc = wx.GCDC(dc) width, height = self.GetClientSize() gc.SetPen(wx.Pen(wx.NamedColour("GREY"), 3)) gc.SetBrush(wx.GREY_BRUSH) gc.DrawLines(ArrowPoints(wx.TOP, width * 0.75, width * 0.5, 2, (width + height) // 4 - 3)) gc.DrawLines(ArrowPoints(wx.TOP, width * 0.75, width * 0.5, 2, (width + height) // 4 + 3)) gc.DrawLines(ArrowPoints(wx.BOTTOM, width * 0.75, width * 0.5, 2, (height * 3 - width) // 4 + 3)) gc.DrawLines(ArrowPoints(wx.BOTTOM, width * 0.75, width * 0.5, 2, (height * 3 - width) // 4 - 3)) thumb_rect = self.GetThumbRect() exclusion_rect = wx.Rect(thumb_rect.x, thumb_rect.y, thumb_rect.width, thumb_rect.height) if self.Parent.IsMessagePanelTop(): exclusion_rect.y, exclusion_rect.height = width, exclusion_rect.y + exclusion_rect.height - width if self.Parent.IsMessagePanelBottom(): exclusion_rect.height = height - width - exclusion_rect.y if exclusion_rect != thumb_rect: colour = wx.NamedColour("LIGHT GREY") gc.SetPen(wx.Pen(colour)) gc.SetBrush(wx.Brush(colour)) gc.DrawRectangle(exclusion_rect.x, exclusion_rect.y, exclusion_rect.width, exclusion_rect.height) gc.SetPen(wx.GREY_PEN) gc.SetBrush(wx.GREY_BRUSH) gc.DrawPolygon(ArrowPoints(wx.TOP, width, width, 0, 0)) gc.DrawPolygon(ArrowPoints(wx.BOTTOM, width, width, 0, height)) gc.DrawRectangle(thumb_rect.x, thumb_rect.y, thumb_rect.width, thumb_rect.height) dc.EndDrawing() event.Skip()