def __init__(self, parent): #wx.Panel.__init__(self, parent, wx.ID_ANY,size=wx.Size(30,103)) wx.Panel.__init__(self, parent, wx.ID_ANY) self._ribbon = RB.RibbonBar(self, wx.ID_ANY) dirName = os.path.dirname(os.path.abspath(sys.argv[0])) bitmapDir = os.path.join(dirName, 'icons') self.bitmap_action_dir = os.path.join(bitmapDir, 'actions') #to tylko na pewien czas #bitmapDir = os.path.join(bitmapDir, 'icons') #sys.path.append(os.path.split(dirName)[0]) self.AddHomePage() self.AddEditPage() self.AddViewPage() self.BindButtons() primary, secondary, tertiary = self._ribbon.GetArtProvider().GetColourScheme(0, 0, 0) #print primary #print secondary #print tertiary art_provider = AR.RibbonArtProvider() art_provider.SetColourScheme(wx.NamedColour("gray"),wx.Colour(255, 223, 114),wx.NamedColour("green")) self._ribbon.SetArtProvider(art_provider) #self._ribbon.GetArtProvider().SetColourScheme(wx.NamedColour("blue"),secondary,tertiary) #self._ribbon.GetArtProvider().SetColourScheme(wx.NamedColour("gray"),wx.NamedColour("yellow"),wx.NamedColour("green")) self._ribbon.Realize() s = wx.BoxSizer(wx.VERTICAL) s.Add(self._ribbon, 0, wx.EXPAND) self.SetSizer(s)
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.Smiles.GetBitmap()) 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)
def process( self,dc,values): hue=values['hue'] import wx src=dc.GetAsBitmap() w,h=dc.GetSizeTuple() #Fill dc with blank newdc=wx.MemoryDC() white=wx.EmptyBitmapRGBA(w,h,255,255,255,0) newdc.SelectObject(white) newdc.Brush=wx.Brush(wx.NamedColour('white'),wx.SOLID) newdc.DrawRectangle(0,0,w,h) #First apply chips mask on the pict mask=wx.Mask(wx.Bitmap('plugins/chips/chips_mask.png'),wx.NamedColour('white')) src.SetMask(mask) newdc.DrawBitmap(src,0,0,True) #Then apply chip border on the pict img=wx.Image('plugins/chips/chips_border.png') img.RotateHue(hue) bmp=wx.BitmapFromImage(img) #bmp=wx.Bitmap('plugins/chips/chips_border.png') mask=wx.Mask(wx.Bitmap('plugins/chips/chips_border_mask.png'),wx.NamedColour('white')) bmp.SetMask(mask) newdc.DrawBitmap(bmp,0,0,True) newdc.SelectObject(wx.NullBitmap) del newdc #Now, clear the old one & paste the modified bitmap dc.Clear() #dc.SetBrush(wx.Brush(wx.NamedColour('white'),wx.SOLID)) #dc.DrawRectangle(0,0,w,h) #dc.DrawBitmap(white),0,0) dc.DrawBitmap(wx.BitmapFromImage(white.ConvertToImage()),0,0)
def render(self, dc): self.computeMath() c = wx.Colour(200, 200, 200) brush = wx.Brush(c, wx.SOLID) dc.SetBackground(brush) dc.Clear() self.scale.render(dc) clist = [ 'BLACK', 'BROWN', 'RED', 'ORANGE', 'YELLOW', 'GREEN', 'BLUE', 'VIOLET', 'GREY', 'WHITE' ] i = 0 (w, h) = self.GetSize() for name in self.traceMemory: c = wx.NamedColour(clist[i % len(clist)]) dc.SetPen(wx.Pen(c)) self.traceMemory[name].render(dc, self.scale, name) dc.SetTextForeground(c) dc.DrawText(name, w - 100, i * 15 + 15) i += 1 c = wx.NamedColour("GREEN") dc.SetPen(wx.Pen(c)) for m in self.cursors: m.render(dc)
def DrawNodes(self, dc): s = self.node_size nodes_screen = numpy.zeros((self.n_nodes, 4)) nodes_screen[:, 0] = self.nodes_screen[:, 0] - s / 2. nodes_screen[:, 1] = self.nodes_screen[:, 1] - s / 2. nodes_screen[:, 2] = s nodes_screen[:, 3] = s brushes = [wx.TRANSPARENT_BRUSH] * self.n_nodes if self.active_node is not None: if self.drawing: brushes[self.active_node] = wx.Brush(wx.NamedColour('RED'), style=wx.SOLID) else: brushes[self.active_node] = wx.Brush(wx.NamedColour('WHITE'), style=wx.SOLID) dc.DrawRectangleList(nodes_screen, pens=wx.Pen(wx.NamedColour('BLACK'), 1, style=wx.SOLID), brushes=brushes) dc.SetBrush(wx.TRANSPARENT_BRUSH) dc.SetPen(wx.Pen("RED", 1)) dc.DrawLines(self.nodes_screen)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize) wred = ColWin(self, wx.NewId(), wx.NamedColour('red')) wgreen = ColWin(self, wx.NewId(), wx.NamedColour('green')) wblue = ColWin(self, wx.NewId(), wx.NamedColour('blue')) b = 10 sizer1 = wx.StaticBoxSizer(wx.StaticBox(self, wx.NewId(), 'Staticbox'), wx.VERTICAL) sizer1.Add(wred, 1, wx.EXPAND | wx.ALL, b) sizer2 = wx.StaticBoxSizer(wx.StaticBox(self, wx.NewId(), 'Staticbox'), wx.VERTICAL) sizer2.Add(wgreen, 1, wx.EXPAND | wx.ALL, b) sizer4 = wx.StaticBoxSizer(wx.StaticBox(self, wx.NewId(), 'Staticbox'), wx.VERTICAL) sizer4.Add(wblue, 1, wx.EXPAND | wx.ALL, b) #tricky: the 2nd and 3rd staticbox sizer are shifted one pixel to the #left, try with b2 = 0 b1, b2 = 0, -1 sizer3 = wx.BoxSizer(wx.HORIZONTAL) sizer3.Add(sizer1, 1, wx.EXPAND, b1) sizer3.Add(sizer2, 1, wx.EXPAND | wx.LEFT, b2) sizer3.Add(sizer4, 1, wx.EXPAND | wx.LEFT, b2) self.SetSizer(sizer3)
def process(self, dc, values): from math import cos, sin, radians, pi olddc = dc w, h = olddc.GetSizeTuple() width = 1 #values['width'] fill = True #values['Fill'] scale = values['Scale'] dc = wx.MemoryDC() white = wx.EmptyBitmapRGBA(w, h, 255, 255, 255, 0) dc.SelectObject(white) #Fill with white dc.SetBrush(wx.Brush(wx.NamedColour('white'), wx.SOLID)) dc.DrawRectangle(0, 0, w, h) minimum = min(h, w) / 2 minimum *= scale dc.SetBrush(wx.Brush("black", wx.SOLID)) dc.DrawCircle(w / 2, h / 2, minimum) #Done with the drawing. dc.SelectObject(wx.NullBitmap) mask = wx.Mask(white, wx.NamedColour('white')) bmp = olddc.GetAsBitmap() bmp.SetMask(mask) dc = olddc dc.SetBrush(wx.Brush(wx.NamedColour('white'), wx.SOLID)) dc.DrawRectangle(0, 0, w, h) dc.DrawBitmap(bmp, 0, 0, True)
def __init__(self, parent): wx.Panel.__init__(self, parent) wwhite = ColWin(self, wx.ID_ANY, wx.WHITE) wblue = ColWin(self, wx.ID_ANY, wx.BLUE) wgreen = ColWin(self, wx.ID_ANY, wx.GREEN) wred = ColWin(self, wx.ID_ANY, wx.RED) wgrey = ColWin(self, wx.ID_ANY, '#a0a0a0') wpink = ColWin(self, wx.ID_ANY, wx.NamedColour('pink')) wyellow = ColWin(self, wx.ID_ANY, wx.NamedColour('yellow')) wcyan = ColWin(self, wx.ID_ANY, wx.NamedColour('cyan')) worange = ColWin(self, wx.ID_ANY, wx.NamedColour('orange')) hstaline1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, (-1, 2), wx.LI_HORIZONTAL) hstaline2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, (-1, 2), wx.LI_HORIZONTAL) vstaline1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, (2, -1), wx.LI_VERTICAL) vstaline2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, (2, -1), wx.LI_VERTICAL) vgap, hgap = 4, 4 gbs = wx.GridBagSizer(vgap, hgap) b = 0 f = wx.EXPAND | wx.ALL b2 = 8 f2 = wx.EXPAND | wx.TOP | wx.BOTTOM b3 = 8 f3 = wx.EXPAND | wx.LEFT | wx.RIGHT gbs.Add(wwhite, (0, 0), (1, 1), f, b) gbs.Add(vstaline1, (0, 1), (5, 1), f3, b3) gbs.Add(wblue, (0, 2), (1, 1), f, b) gbs.Add(vstaline2, (0, 3), (5, 1), f3, b3) gbs.Add(wgreen, (0, 4), (1, 1), f, b) gbs.Add(hstaline1, (1, 0), (1, 5), f2, b2) gbs.Add(wred, (2, 0), (1, 1), f, b) gbs.Add(wgrey, (2, 2), (1, 1), f, b) gbs.Add(wpink, (2, 4), (1, 1), f, b) gbs.Add(hstaline2, (3, 0), (1, 5), f, b2) gbs.Add(wyellow, (4, 0), (1, 1), f, b) gbs.Add(wcyan, (4, 2), (1, 1), f, b) gbs.Add(worange, (4, 4), (1, 1), f, b) gbs.AddGrowableRow(0) gbs.AddGrowableRow(2) gbs.AddGrowableRow(4) gbs.AddGrowableCol(0) gbs.AddGrowableCol(2) gbs.AddGrowableCol(4) self.SetSizer(gbs)
def __init__(self, tree): self.tree = tree self.textcolor = wx.NamedColour("BLACK") self.bgcolor = wx.NamedColour("WHITE") self.fgcolor = wx.NamedColour("BLUE") self.linecolor = wx.NamedColour("GREY") self.font = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False) self.bmp = None
def get_xy_label(self, conf): self.sbox_xy = wx.StaticBox(self, -1, L('AXES_VALUES')) sboxs_grid = wx.StaticBoxSizer(self.sbox_xy, wx.VERTICAL) _label = L('IN_X') self.x_ch = wx.CheckBox(self, -1, _label, style=wx.ALIGN_RIGHT) self.x_ch.SetValue(conf.x_axis_show) self.x_ch.Bind(wx.EVT_CHECKBOX, self.on_checked_x_axes_label) self.x_label_color = wx.StaticText(self, -1, L('COLOR_X')) _c = wx.NamedColour(conf.x_axis_color) self.x_label_color_cs = csel.ColourSelect(self, colour=_c) self.x_label_color_cs.Enable(conf.x_axis_show) _label = L('IN_Y') self.y_ch = wx.CheckBox(self, -1, _label, style=wx.ALIGN_RIGHT) self.y_ch.SetValue(conf.y_axis_show) self.y_ch.Bind(wx.EVT_CHECKBOX, self.on_checked_y_axes_label) self.y_label_color = wx.StaticText(self, -1, L('COLOR_Y')) _c = wx.NamedColour(conf.y_axis_color) self.y_label_color_cs = csel.ColourSelect(self, colour=_c) self.y_label_color_cs.Enable(conf.y_axis_show) _label = L('LABEL_STILE_LATEX_X') self.ll_ch = wx.CheckBox(self, -1, _label, style=wx.ALIGN_RIGHT) self.ll_ch.SetValue(conf.x_label_latex_show) self.x_label_des_spin = wx.StaticText(self, -1, L('LABEL_SIZE_X')) self.x_label_zize_spin = wx.SpinCtrl(self, -1, "") self.x_label_zize_spin.SetRange(1, 50) self.x_label_zize_spin.SetValue(conf.xticklabelssize) grid = wx.FlexGridSizer(cols=5) grid.Add(self.x_ch, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, ""), 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.y_ch, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, ""), 0, wx.ALIGN_LEFT | wx.ALL, 5) _style = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL grid.Add(self.x_label_color, 0, _style, 5) grid.Add(self.x_label_color_cs, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.y_label_color, 0, _style, 5) grid.Add(self.y_label_color_cs, 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(self.ll_ch, 0, _style, 5) grid.Add(wx.StaticText(self, -1, ""), 0, wx.ALIGN_LEFT | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.x_label_des_spin, 0, _style, 5) grid.Add(self.x_label_zize_spin, 0, wx.ALIGN_LEFT | wx.ALL, 5) sboxs_grid.Add(grid, 1, wx.EXPAND | wx.ALL, 10) return sboxs_grid
def SetColors(self): self.row_def_line_colour = wx.NamedColour(wx.Colour(128,128,128)) self.row_def_line_size = 1 self.column_def_line_colour = wx.NamedColour(wx.Colour(128,128,128)) self.column_def_line_size = 1 self.column_colour = wx.NamedColour('WHITE') self.label_colour = wx.NamedColour('LIGHT GREY')
def strcolor(x): if type(x)==type(wx.Colour()): return x if wx.NamedColour(x).IsOk(): return wx.NamedColour(x) if not x: return wx.Colour() if x=="None": return wx.Colour() exec 'c=wx.Colour%s'%x return c
def update_programme_text_colour(self, programme): """ Update the display colour of the specified programme """ if programme is not None: for episode in programme.episodes: if not episode.downloaded: self.SetItemTextColour(programme.view_item, wx.NamedColour(NORMAL_TEXT_COLOUR)) return # Programme contains only downloaded episodes self.SetItemTextColour(programme.view_item, wx.NamedColour(DOWNLOADED_TEXT_COLOUR))
def SetTextOverlay(self, field, msg, foreground=None, background=None): w = wx.StaticText(self, -1, msg) if foreground is not None: if isinstance(foreground, (str, unicode)): foreground = wx.NamedColour(foreground) w.SetForegroundColour(foreground) if background is not None: if isinstance(background, (str, unicode)): background = wx.NamedColour(background) w.SetBackgroundColour(background) self.SetOverlay(field, w)
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()
def __init__(self): # Set some defaults #self.cellbackground=wx.TheBrushList.FindOrCreateBrush(wx.Colour(230,255,255), wx.SOLID) self.cellbackground = wx.Brush(wx.Colour(197, 255, 255), wx.SOLID) self.labelfont = wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL) self.labelforeground = wx.NamedColour("CORNFLOWER BLUE") self.labelalign = wx.ALIGN_RIGHT self.timefont = wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL) self.timeforeground = wx.NamedColour("ORCHID") self.entryfont = wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL) self.entryforeground = wx.NamedColour("BLACK") self.miltime = False self.initdone = True
def set_style(self, style): if style is self.last_style: return self.last_style = style weight = { 'bold' : wx.FONTWEIGHT_BOLD, 'normal' : wx.NORMAL }[style['weight']] font = wx.Font(style['fontsize'], wx.MODERN, wx.NORMAL, weight, style['underline'], style['facename']) self.dc.SetFont(font) self.dc.SetTextBackground(wx.NamedColour(style['bgcolor'])) self.dc.SetTextForeground(wx.NamedColour(style['textcolor']))
def get_spines_figure(self, a_conf): self.sbox_spf = wx.StaticBox(self, -1, L('EDGES')) sboxs_spf = wx.StaticBoxSizer(self.sbox_spf, wx.VERTICAL) grid = wx.FlexGridSizer(cols=5) # ---- color de bordes self.top_label = wx.StaticText(self, -1, L('TOP')) _c = wx.NamedColour(a_conf.color_top_spine) self.clr_top_sp = csel.ColourSelect(self, -1, L('CHOOSE_A_COLOR'), _c, size=(120, 30)) self.bottom_label = wx.StaticText(self, -1, L('BOTTOM')) _c = wx.NamedColour(a_conf.color_bottom_spine) self.clr_bottom_sp = csel.ColourSelect(self, -1, L('CHOOSE_A_COLOR'), _c, size=(120, 30)) self.left_label = wx.StaticText(self, -1, L('LEFT')) _c = wx.NamedColour(a_conf.color_left_spine) self.clr_left_sp = csel.ColourSelect(self, -1, L('CHOOSE_A_COLOR'), _c, size=(120, 30)) self.right_label = wx.StaticText(self, -1, L('RIGHT')) _c = wx.NamedColour(a_conf.color_right_spine) _l = L('CHOOSE_A_COLOR') self.clr_right_sp = csel.ColourSelect(self, -1, _l, _c, size=(120, 30)) _style = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL grid.Add(self.top_label, 0, _style, 5) grid.Add(self.clr_top_sp, 0, wx.EXPAND | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.bottom_label, 0, _style, 5) grid.Add(self.clr_bottom_sp, 0, wx.EXPAND | wx.ALL, 5) grid.Add(self.left_label, 0, _style, 5) grid.Add(self.clr_left_sp, 0, wx.EXPAND | wx.ALL, 5) grid.Add(wx.StaticText(self, -1, " "), wx.ALL) grid.Add(self.right_label, 0, _style, 5) grid.Add(self.clr_right_sp, 0, wx.EXPAND | wx.ALL, 5) sboxs_spf.Add(grid, 0, wx.ALL, 3) return sboxs_spf
def set_style(self, style): if style is self.last_style: return self.last_style = style _style = filled(style) font = get_font(_style) self.dc.SetFont(font) try: # Phoenix self.dc.SetTextBackground(wx.Colour(_style['bgcolor'])) self.dc.SetTextForeground(wx.Colour(_style['textcolor'])) except TypeError: # Classic self.dc.SetTextBackground(wx.NamedColour(_style['bgcolor'])) self.dc.SetTextForeground(wx.NamedColour(_style['textcolor']))
def draw(self, dc, coord=None): colour = self.attributes['colour'] width = self.attributes['width'] size = self.attributes['size'] fillcolour = self.attributes['fillcolour'] fillstyle = self.attributes['fillstyle'] marker = self.attributes['marker'] dc.SetPen(wx.Pen(wx.NamedColour(colour), int(width))) if fillcolour: dc.SetBrush(wx.Brush(wx.NamedColour(fillcolour), fillstyle)) else: dc.SetBrush(wx.Brush(wx.NamedColour(colour), fillstyle)) self._drawmarkers(dc, self.scaled, marker, size)
def drawLines(dc, *lines): ''' drawLines takes a device context (dc) and a list of lines as arguments. Each line is a three-tuple: (colour, thickness, linesegments). linesegments is a list of coordinates: (x1, y1, x2, y2). ''' dc.BeginDrawing() pen = wx.Pen(wx.NamedColour('RED'), 1, wx.SOLID) dc.SetPen(pen) dc.DrawPolygon([(20, 20), (20, 80), (80, 80), (80, 20)]) for colour, thickness, lineSegments in lines: pen = wx.Pen(wx.NamedColour(colour), thickness, wx.SOLID) dc.SetPen(pen) for lineSegment in lineSegments: dc.DrawLine(*lineSegment) dc.EndDrawing()
def draw(self, dc): color = self.attributes['color'] width = self.attributes['width'] size = self.attributes['size'] fillcolor = self.attributes['fillcolor'] fillstyle = self.attributes['fillstyle'] marker = self.attributes['marker'] dc.SetPen(wx.Pen(wx.NamedColour(color), width)) if fillcolor: dc.SetBrush(wx.Brush(wx.NamedColour(fillcolor), fillstyle)) else: dc.SetBrush(wx.Brush(wx.NamedColour('black'), wx.TRANSPARENT)) self._drawmarkers(dc, self.scaled, marker, size)
def set_color_default(): cal_year.cycle.colour_set = { 'begin': wx.NamedColour('RED'), 'prog begin': wx.NamedColour('PINK'), 'conception': wx.NamedColour('MAGENTA'), 'safe sex': wx.NamedColour('WHEAT'), 'fertile': wx.NamedColour('GREEN YELLOW'), 'ovule': wx.NamedColour('SPRING GREEN'), '1-st tablet': wx.NamedColour('GOLD'), 'pause': wx.NamedColour('LIGHT BLUE'), 'next 1-st tablet': wx.NamedColour('PINK') }
def __init__(self, parent, log): ULC.UltimateListCtrl.__init__(self, parent, -1, agwStyle=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES | wx.LC_VRULES | ULC.ULC_SHOW_TOOLTIPS) self.log = log self.il = wx.ImageList(16, 16) self.il.Add(images.Smiles.GetBitmap()) self.il.Add(images.core.GetBitmap()) self.il.Add(images.custom.GetBitmap()) self.il.Add(images.exit.GetBitmap()) self.il.Add(images.expansion.GetBitmap()) self.SetImageList(self.il, wx.IMAGE_LIST_SMALL) self.InsertColumn(0, "First") self.InsertColumn(1, "Second") self.InsertColumn(2, "Third") self.SetColumnWidth(0, 175) self.SetColumnWidth(1, 175) self.SetColumnWidth(2, 175) self.SetColumnToolTip(0, "First Column Tooltip!") self.SetColumnToolTip(1, "Second Column Tooltip!") self.SetColumnToolTip(2, "Third Column Tooltip!") # After setting the column width you can specify that # this column expands to fill the window. Only one # column may be specified. self.SetColumnWidth(2, ULC.ULC_AUTOSIZE_FILL) self.SetItemCount(1000000) self.attr1 = ULC.UltimateListItemAttr() self.attr1.SetBackgroundColour(wx.NamedColour("yellow")) self.attr2 = ULC.UltimateListItemAttr() self.attr2.SetBackgroundColour(wx.NamedColour("light blue")) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected) self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeselected) self.randomLists = [GenerateRandomList(self.il) for i in xrange(5)]
def OnDefault(self, event): self.col_set = {'begin':wx.NamedColour('RED'), 'prog begin':wx.NamedColour('PINK'), 'conception':wx.NamedColour('MAGENTA'), 'safe sex':wx.NamedColour('WHEAT'), 'fertile':wx.NamedColour('GREEN YELLOW'), 'ovule':wx.NamedColour('SPRING GREEN'), '1-st tablet':wx.NamedColour('GOLD'), 'pause':wx.NamedColour('LIGHT BLUE'), 'next 1-st tablet':wx.NamedColour('PINK')} for item in self.col_id: self.buttons[self.col_id.index(item)].SetBackgroundColour(self.col_set[item])
def __init__(self, parent): wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize) wgreen = ColWin(self, wx.NewId(), wx.NamedColour('green')) b1 = wx.Button(self, wx.NewId(), 'button1', (-1, -1), wx.DefaultSize) b2 = wx.Button(self, wx.NewId(), 'button2', (-1, -1), wx.DefaultSize) b3 = wx.Button(self, wx.NewId(), 'button3', (-1, -1), wx.DefaultSize) b = 0 hsizer1 = wx.BoxSizer(wx.HORIZONTAL) hsizer1.Add(b1, 0, wx.ALL, b) hsizer1.Add((-1, -1), 1) hsizer1.Add(b2, 0, wx.ALL, b) hsizer1.Add((-1, -1), 1) hsizer1.Add(b3, 0, wx.ALL, b) #tip: this does not work #~ b = 0 #~ hsizer1 = wx.BoxSizer(wx.HORIZONTAL) #~ hsizer1.Add(b1, 0, wx.ALIGN_LEFT, b) #~ hsizer1.Add(b2, 0, wx.ALIGN_CENTER, b) #~ hsizer1.Add(b3, 0, wx.ALIGN_RIGHT, b) b = 5 vsizer2 = wx.BoxSizer(wx.VERTICAL) vsizer2.Add(wgreen, 1, wx.EXPAND | wx.ALL, b) vsizer2.Add(hsizer1, 0, wx.EXPAND | wx.ALL, b) self.SetSizer(vsizer2)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize) wred = ColWin(self, wx.NewId(), wx.RED) wblue = ColWin(self, wx.NewId(), wx.BLUE) wgreen = ColWin(self, wx.NewId(), wx.GREEN) wwhite = ColWin(self, wx.NewId(), wx.WHITE) wyellow = ColWin(self, wx.NewId(), wx.NamedColour('yellow')) b = 10 vsbsizer1 = wx.StaticBoxSizer(wx.StaticBox(self, wx.NewId(), 'blue'), wx.VERTICAL) vsbsizer1.Add(wblue, 1, wx.EXPAND | wx.ALL, b) vsbsizer2 = wx.StaticBoxSizer(wx.StaticBox(self, wx.NewId(), 'white'), wx.VERTICAL) vsbsizer2.Add(wwhite, 1, wx.EXPAND | wx.ALL, b) b = 5 vsizer1 = wx.BoxSizer(wx.VERTICAL) vsizer1.Add(wred, 1, wx.EXPAND | wx.ALL, b) vsizer1.Add(vsbsizer1, 1, wx.EXPAND | wx.ALL, b) vsizer1.Add(wgreen, 1, wx.EXPAND | wx.ALL, b) vsizer1.Add(vsbsizer2, 1, wx.EXPAND | wx.ALL, b) vsizer1.Add(wyellow, 1, wx.EXPAND | wx.ALL, b) self.SetSizer(vsizer1)
def getStyle(self, c='black'): """ Returns a style for a given colour if one exists. If no style exists for the colour, make a new style. If we run out of styles, (only 32 allowed here) we go to the top of the list and reuse previous styles. """ free = self._free if c and isinstance(c, (str, unicode)): c = c.lower() else: c = 'black' try: style = self._styles.index(c) return style except ValueError: style = free self._styles[style] = c self.StyleSetForeground(style, wx.NamedColour(c)) free += 1 if free > 31: free = 0 self._free = free return style
def ColourFromStyle(col): if isinstance(col, six.string_types): col = wx.NamedColour(col) else: col = wx.Colour(*col) return col
def _makeColour(colour): # make a wx.Colour from any of the allowed typemaps (string, tuple, # etc.) if isinstance(colour, (basestring, tuple)): return wx.NamedColour(colour) else: return colour