當前位置: 首頁>>代碼示例>>Python>>正文


Python wx.BLACK屬性代碼示例

本文整理匯總了Python中wx.BLACK屬性的典型用法代碼示例。如果您正苦於以下問題:Python wx.BLACK屬性的具體用法?Python wx.BLACK怎麽用?Python wx.BLACK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在wx的用法示例。


在下文中一共展示了wx.BLACK屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
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 
開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:24,代碼來源:core.py

示例2: get_text_width_height_descent

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def get_text_width_height_descent(self, s, prop, ismath):
        """
        get the width and height in display coords of the string s
        with FontPropertry prop
        """
        #return 1, 1
        if ismath: s = self.strip_math(s)

        if self.gc is None:
            gc = self.new_gc()
        else:
            gc = self.gc
        gfx_ctx = gc.gfx_ctx
        font = self.get_wx_font(s, prop)
        gfx_ctx.SetFont(font, wx.BLACK)
        w, h, descent, leading = gfx_ctx.GetFullTextExtent(s)

        return w, h, descent 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:20,代碼來源:backend_wx.py

示例3: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def __init__(self, bitmap, renderer):
        GraphicsContextBase.__init__(self)
        #assert self.Ok(), "wxMemoryDC not OK to use"
        DEBUG_MSG("__init__()", 1, self)

        dc, gfx_ctx = self._cache.get(bitmap, (None, None))
        if dc is None:
            dc = wx.MemoryDC()
            dc.SelectObject(bitmap)
            gfx_ctx = wx.GraphicsContext.Create(dc)
            gfx_ctx._lastcliprect = None
            self._cache[bitmap] = dc, gfx_ctx

        self.bitmap = bitmap
        self.dc = dc
        self.gfx_ctx = gfx_ctx
        self._pen = wx.Pen('BLACK', 1, wx.SOLID)
        gfx_ctx.SetPen(self._pen)
        self._style = wx.SOLID
        self.renderer = renderer 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:22,代碼來源:backend_wx.py

示例4: get_text_width_height_descent

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def get_text_width_height_descent(self, s, prop, ismath):
        # docstring inherited

        if ismath:
            s = cbook.strip_math(s)

        if self.gc is None:
            gc = self.new_gc()
        else:
            gc = self.gc
        gfx_ctx = gc.gfx_ctx
        font = self.get_wx_font(s, prop)
        gfx_ctx.SetFont(font, wx.BLACK)
        w, h, descent, leading = gfx_ctx.GetFullTextExtent(s)

        return w, h, descent 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:18,代碼來源:backend_wx.py

示例5: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def __init__(self, bitmap, renderer):
        GraphicsContextBase.__init__(self)
        # assert self.Ok(), "wxMemoryDC not OK to use"
        DEBUG_MSG("__init__()", 1, self)
        DEBUG_MSG("__init__() 2: %s" % bitmap, 1, self)

        dc, gfx_ctx = self._cache.get(bitmap, (None, None))
        if dc is None:
            dc = wx.MemoryDC()
            dc.SelectObject(bitmap)
            gfx_ctx = wx.GraphicsContext.Create(dc)
            gfx_ctx._lastcliprect = None
            self._cache[bitmap] = dc, gfx_ctx

        self.bitmap = bitmap
        self.dc = dc
        self.gfx_ctx = gfx_ctx
        self._pen = wx.Pen('BLACK', 1, wx.SOLID)
        gfx_ctx.SetPen(self._pen)
        self.renderer = renderer 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:22,代碼來源:backend_wx.py

示例6: get_text_width_height_descent

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def get_text_width_height_descent(self, s, prop, ismath):
        """
        get the width and height in display coords of the string s
        with FontPropertry prop
        """
        # return 1, 1
        if ismath:
            s = self.strip_math(s)

        if self.gc is None:
            gc = self.new_gc()
        else:
            gc = self.gc
        gfx_ctx = gc.gfx_ctx
        font = self.get_wx_font(s, prop)
        gfx_ctx.SetFont(font, wx.BLACK)
        w, h, descent, leading = gfx_ctx.GetFullTextExtent(s)

        return w, h, descent 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:21,代碼來源:backend_wx.py

示例7: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def __init__(self, bitmap, renderer):
        GraphicsContextBase.__init__(self)
        # assert self.Ok(), "wxMemoryDC not OK to use"
        DEBUG_MSG("__init__()", 1, self)
        DEBUG_MSG("__init__() 2: %s" % bitmap, 1, self)

        dc, gfx_ctx = self._cache.get(bitmap, (None, None))
        if dc is None:
            dc = wx.MemoryDC()
            dc.SelectObject(bitmap)
            gfx_ctx = wx.GraphicsContext.Create(dc)
            gfx_ctx._lastcliprect = None
            self._cache[bitmap] = dc, gfx_ctx

        self.bitmap = bitmap
        self.dc = dc
        self.gfx_ctx = gfx_ctx
        self._pen = wx.Pen('BLACK', 1, wx.SOLID)
        gfx_ctx.SetPen(self._pen)
        self._style = wx.SOLID
        self.renderer = renderer 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:23,代碼來源:backend_wx.py

示例8: on_paint

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def on_paint(self, event):
        dc = wx.PaintDC(self.widget)
        dc.SetBrush(wx.WHITE_BRUSH)
        dc.SetPen(wx.BLACK_PEN)
        dc.SetBackground(wx.WHITE_BRUSH)
        dc.Clear()
        w, h = self.widget.GetClientSize()
        dc.DrawLine(0, 0, w, h)
        dc.DrawLine(w, 0, 0, h)
        text = _('Custom Widget: %s') % self.instance_class
        tw, th = dc.GetTextExtent(text)
        x = (w - tw)//2
        y = (h - th)//2
        dc.SetPen(wx.ThePenList.FindOrCreatePen(wx.BLACK, 0, wx.TRANSPARENT))
        dc.DrawRectangle(x-1, y-1, tw+2, th+2)
        dc.DrawText(text, x, y) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:18,代碼來源:custom_widget.py

示例9: on_paint

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def on_paint(self, event):
        dc = wx.PaintDC(self.widget)
        brush = wx.TheBrushList.FindOrCreateBrush( self.widget.GetBackgroundColour() )
        dc.SetBrush(brush)
        dc.SetPen(wx.ThePenList.FindOrCreatePen(wx.BLACK, 1, wx.SOLID))
        dc.SetBackground(brush)
        dc.Clear()
        w, h = self.widget.GetClientSize()
        dc.DrawLine(0, 0, w, h)
        dc.DrawLine(w, 0, 0, h)
        text = _('Spacer')
        tw, th = dc.GetTextExtent(text)
        x = (w - tw) // 2
        y = (h - th) // 2
        dc.SetPen(wx.ThePenList.FindOrCreatePen(wx.BLACK, 0, wx.TRANSPARENT))
        dc.DrawRectangle(x-1, y-1, tw+2, th+2)
        dc.DrawText(text, x, y) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:19,代碼來源:spacer.py

示例10: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def __init__(self, parent, type, name, id=None, extension=0, inputs=None, connectors=None, executionControl=False, executionOrder=0):
        Graphic_Element.__init__(self, parent)
        self.Type = None
        self.Description = None
        self.Extension = None
        self.ExecutionControl = False
        self.Id = id
        self.SetName(name)
        self.SetExecutionOrder(executionOrder)
        self.Inputs = []
        self.Outputs = []
        self.Colour = wx.BLACK
        self.Pen = MiterPen(wx.BLACK)
        self.SetType(type, extension, inputs, connectors, executionControl)
        self.Highlights = {}

    # Make a clone of this FBD_Block 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:19,代碼來源:FBD_Objects.py

示例11: Draw

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def Draw(self, dc):
        Graphic_Element.Draw(self, dc)
        dc.SetPen(MiterPen(wx.BLACK))
        dc.SetBrush(wx.BLACK_BRUSH)
        # Draw a rectangle with the power rail size
        if self.Type == LEFTRAIL:
            dc.DrawRectangle(self.Pos.x + self.Size[0] - LD_POWERRAIL_WIDTH, self.Pos.y, LD_POWERRAIL_WIDTH + 1, self.Size[1] + 1)
        else:
            dc.DrawRectangle(self.Pos.x, self.Pos.y, LD_POWERRAIL_WIDTH + 1, self.Size[1] + 1)
        # Draw connectors
        for connector in self.Connectors:
            connector.Draw(dc)


# -------------------------------------------------------------------------------
#                         Ladder Diagram Contact
# ------------------------------------------------------------------------------- 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:19,代碼來源:LD_Objects.py

示例12: DrawHighlightedText

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def DrawHighlightedText(dc, text, highlights, x, y):
    current_pen = dc.GetPen()
    dc.SetPen(wx.TRANSPARENT_PEN)
    for start, end, highlight_type in highlights:
        dc.SetBrush(wx.Brush(highlight_type[0]))
        offset_width, _offset_height = dc.GetTextExtent(text[:start[1]])
        part = text[start[1]:end[1] + 1]
        part_width, part_height = dc.GetTextExtent(part)
        dc.DrawRectangle(x + offset_width, y, part_width, part_height)
        dc.SetTextForeground(highlight_type[1])
        dc.DrawText(part, x + offset_width, y)
    dc.SetPen(current_pen)
    dc.SetTextForeground(wx.BLACK)


# -------------------------------------------------------------------------------
#                           Graphic element base class
# ------------------------------------------------------------------------------- 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:20,代碼來源:GraphicCommons.py

示例13: Draw

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def Draw(self, dc):
        scalex, scaley = dc.GetUserScale()
        dc.SetUserScale(1, 1)
        x, y = self.Parent.CalcUnscrolledPosition(self.x_offset, self.y_offset)

        text = self.GetInstanceName()
        if self.ActionState is not None:
            text += " ("

        dc.DrawText(text, x, y)
        tw, _th = dc.GetTextExtent(text)
        if self.ActionState is not None:

            text = self.VALUE_TRANSLATION[self.ActionState]
            if self.ActionState:
                dc.SetTextForeground(wx.GREEN)
            dc.DrawText(text, x + tw, y)
            if self.ActionState:
                dc.SetTextForeground(wx.BLACK)
            tw = tw + dc.GetTextExtent(text)[0]

            text = ")"
            dc.DrawText(text, x + tw, y)
        dc.SetUserScale(scalex, scaley) 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:26,代碼來源:Viewer.py

示例14: _updateColAttrs

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def _updateColAttrs(self, grid):
        """
        wx.grid.Grid -> update the column attributes to add the
        appropriate renderer given the column name.

        Otherwise default to the default renderer.
        """
        for row in range(self.GetNumberRows()):
            row_highlights = self.Highlights.get(row, {})
            for col in range(self.GetNumberCols()):
                colname = self.GetColLabelValue(col, False)

                grid.SetReadOnly(row, col, True)
                grid.SetCellEditor(row, col, None)
                grid.SetCellRenderer(row, col, None)

                highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
                grid.SetCellBackgroundColour(row, col, highlight_colours[0])
                grid.SetCellTextColour(row, col, highlight_colours[1])
            self.ResizeRow(grid, row) 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:22,代碼來源:CustomTable.py

示例15: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import BLACK [as 別名]
def __init__(self, *args, **kwargs):
        wx.grid.Grid.__init__(self, *args, **kwargs)

        self.Editable = True

        self.AddButton = None
        self.DeleteButton = None
        self.UpButton = None
        self.DownButton = None

        self.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans'))
        self.SetLabelFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans'))
        self.SetSelectionBackground(wx.WHITE)
        self.SetSelectionForeground(wx.BLACK)
        self.DisableDragRowSize()

        self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSelectCell)
        self.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.OnEditorHidden)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:21,代碼來源:CustomGrid.py


注:本文中的wx.BLACK屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。