我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用wx.BLUE。
def _log(self, line, status='info'): """Writing given line to the log-textCtrl. :Parameters: - `line`: text to log - `status`: status should be 'info' or 'error'. If 'info' the text will be colored blue, if 'error' the text will be red. """ start = self.txtCtrlLog.GetLastPosition() self.txtCtrlLog.AppendText('%s\n' % line) color = wx.BLACK if status == 'info': color = wx.BLUE elif status == 'error': color = wx.RED self.txtCtrlLog.SetStyle(start, self.txtCtrlLog.GetLastPosition(), wx.TextAttr(color))
def log(self, timestamp, direction, clientid, packet): self.list.InsertStringItem(self.listitem, str(self.listitem)) if direction.startswith("C"): self.list.SetItemTextColour(self.listitem, wx.RED) else: self.list.SetItemTextColour(self.listitem, wx.BLUE) self.list.SetStringItem(self.listitem, 1, timestamp) self.list.SetStringItem(self.listitem, 2, direction) self.list.SetStringItem(self.listitem, 3, clientid) self.list.SetStringItem(self.listitem, 4, packet) self.list.SetItemData(self.listitem, self.listitem) self.itemDataMap[self.listitem] = (self.listitem, timestamp, direction, clientid, packet) self.list.EnsureVisible(self.listitem) self.listitem += 1
def set_mode_color(self): modecolors = {'compass': wx.GREEN, 'gps': wx.YELLOW, 'wind': wx.BLUE, 'true wind': wx.CYAN} if self.enabled and self.mode in modecolors: color = modecolors[self.mode] else: color = wx.RED self.tbAP.SetForegroundColour(color)
def Draw(self, dc): Graphic_Element.Draw(self, dc) if self.Value: if self.Forced: dc.SetPen(MiterPen(wx.CYAN)) else: dc.SetPen(MiterPen(wx.GREEN)) elif self.Forced: dc.SetPen(MiterPen(wx.BLUE)) else: dc.SetPen(MiterPen(wx.BLACK)) dc.SetBrush(wx.WHITE_BRUSH) if getattr(dc, "printing", False): name_size = dc.GetTextExtent(self.Name) else: name_size = self.NameSize # Draw two rectangles for representing the step dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1) if self.Initial: dc.DrawRectangle(self.Pos.x + 2, self.Pos.y + 2, self.Size[0] - 3, self.Size[1] - 3) # Draw step name name_pos = (self.Pos.x + (self.Size[0] - name_size[0]) / 2, self.Pos.y + (self.Size[1] - name_size[1]) / 2) dc.DrawText(self.Name, name_pos[0], name_pos[1]) # Draw input and output connectors if self.Input: self.Input.Draw(dc) if self.Output: self.Output.Draw(dc) if self.Action: self.Action.Draw(dc) if not getattr(dc, "printing", False): DrawHighlightedText(dc, self.Name, self.Highlights, name_pos[0], name_pos[1]) # ------------------------------------------------------------------------------- # Sequencial Function Chart Transition # -------------------------------------------------------------------------------
def RefreshViewer(self): """ Method that refresh the content displayed by Viewer """ # Create buffered DC for drawing in panel width, height = self.GetSize() bitmap = wx.EmptyBitmap(width, height) dc = wx.BufferedDC(wx.ClientDC(self), bitmap) dc.Clear() # Get Graphics Context for DC, for anti-aliased and transparent # rendering gc = wx.GCDC(dc) gc.BeginDrawing() # Get first item item = self.ItemsDict.values()[0] # Get item variable path masked according Debug Variable Panel mask item_path = item.GetVariable( self.ParentWindow.GetVariableNameMask()) # Draw item variable path at Viewer left side w, h = gc.GetTextExtent(item_path) gc.DrawText(item_path, 20, (height - h) / 2) # Update 'Release' button state and text color according to item forced # flag value item_forced = item.IsForced() self.Buttons[1].Enable(item_forced) self.RefreshButtonsPosition() if item_forced: gc.SetTextForeground(wx.BLUE) # Draw item current value at right side of Viewer item_value = item.GetValue() w, h = gc.GetTextExtent(item_value) gc.DrawText(item_value, width - 40 - w, (height - h) / 2) # Draw other Viewer common elements self.DrawCommonElements(gc) gc.EndDrawing()
def Set_ReadOnly(self): #print "cols n rows",self.grid_1.GetNumberCols(),self.grid_1.GetNumberRows() for i in range(1,self.grid_1.GetNumberCols(),1): if self.grid_1.GetNumberCols()>8:# =="Basic Science": for j in range(0,self.grid_1.GetNumberRows(),1): if i==9: self.grid_1.SetCellBackgroundColour(j, i, wx.RED) self.grid_1.SetCellTextColour(j,i, wx.BLACK) self.grid_1.SetReadOnly(j,i, True) elif i==10: self.grid_1.SetCellBackgroundColour(j, i, wx.GREEN) self.grid_1.SetCellTextColour(j,i, wx.BLACK) self.grid_1.SetReadOnly(j,i, True) elif i==11: self.grid_1.SetCellBackgroundColour(j, i, wx.BLUE) self.grid_1.SetCellTextColour(j,i, wx.WHITE) self.grid_1.SetReadOnly(j,i, True) elif i==12: self.grid_1.SetCellBackgroundColour(j, i, wx.BLACK) self.grid_1.SetCellTextColour(j,i, wx.WHITE) self.grid_1.SetReadOnly(j,i, True) else: self.grid_1.SetCellBackgroundColour(j, i, wx.WHITE) self.grid_1.SetCellTextColour(j,i, wx.BLACK) self.grid_1.SetReadOnly(j,i, False) else: for j in range(0,self.grid_1.GetNumberRows(),1): if i==5: self.grid_1.SetCellBackgroundColour(j, i, wx.BLUE) self.grid_1.SetCellTextColour(j,i, wx.WHITE) self.grid_1.SetReadOnly(j,i, True) elif i==6: self.grid_1.SetCellBackgroundColour(j, i, wx.BLACK) self.grid_1.SetCellTextColour(j,i, wx.WHITE) self.grid_1.SetReadOnly(j,i, True) else: self.grid_1.SetCellBackgroundColour(j, i, wx.WHITE) self.grid_1.SetCellTextColour(j,i, wx.BLACK) self.grid_1.SetReadOnly(j,i, False)