当前位置: 首页>>代码示例>>Python>>正文


Python wx.Pen方法代码示例

本文整理汇总了Python中wx.Pen方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Pen方法的具体用法?Python wx.Pen怎么用?Python wx.Pen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx的用法示例。


在下文中一共展示了wx.Pen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SetPen

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def SetPen(self, LineColor, LineStyle, LineWidth):
        """
        Set the Pen for this DrawObject
        
        :param `LineColor`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetColor`
         for valid entries
        :param `LineStyle`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetLineStyle`
         for valid entries
        :param integer `LineWidth`: the width in pixels 
        """
        if (LineColor is None) or (LineStyle is None):
            self.Pen = wx.TRANSPARENT_PEN
            self.LineStyle = 'Transparent'
        else:
            self.Pen = self.PenList.setdefault(
                (LineColor, LineStyle, LineWidth),
                wx.Pen(LineColor, LineWidth, self.LineStyleList[LineStyle])) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:19,代码来源:FCObjects.py

示例2: SetUpDraw

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def SetUpDraw(self, dc, WorldToPixel, ScaleWorldToPixel, HTdc):
        """
        Setup for draw
        
        :param `dc`: the dc to draw ???
        :param `WorldToPixel`: ???
        :param `ScaleWorldToPixel`: ???
        :param `HTdc`: ???
        
        """
        dc.SetPen(self.Pen)
        dc.SetBrush(self.Brush)
        if HTdc and self.HitAble:
            HTdc.SetPen(self.HitPen)
            HTdc.SetBrush(self.HitBrush)
        return ( WorldToPixel(self.XY),
                 ScaleWorldToPixel(self.WH) ) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:19,代码来源:FCObjects.py

示例3: _Draw

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None):
        Size = self.Size
        dc.SetPen(self.Pen)
        xc,yc = WorldToPixel(self.XY)

        if self.Size <= 1:
            dc.DrawPoint(xc, yc)
        else:
            x = xc - Size/2.0
            y = yc - Size/2.0
            dc.SetBrush(self.Brush)
            dc.DrawRectangle(x, y, Size, Size)
        if HTdc and self.HitAble:
            HTdc.SetPen(self.HitPen)
            if self.Size <= 1:
                HTdc.DrawPoint(xc, xc)
            else:
                HTdc.SetBrush(self.HitBrush)
                HTdc.DrawRectangle(x, y, Size, Size) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:21,代码来源:FCObjects.py

示例4: _DC_DrawPointList

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def _DC_DrawPointList(self, points, pens=None):
    """
    Draw a list of points as quickly as possible.
    
    :param points: A sequence of 2-element sequences representing 
                   each point to draw, (x,y).
    :param pens:   If None, then the current pen is used.  If a single 
                   pen then it will be used for all points.  If a list of 
                   pens then there should be one for each point in points.
    """
    if pens is None:
        pens = []
    elif isinstance(pens, wx.Pen):
        pens = [pens]
    elif len(pens) != len(points):
        raise ValueError('points and pens must have same length')
    return self._DrawPointList(points, pens, []) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:19,代码来源:core.py

示例5: draw_ticks

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def draw_ticks(self, ticks):
        """
        Print the tickmarks.

        Parameters
        ----------
        ticks : list of (string, value, pixel) tuples
        """
        pen = wx.Pen(wx.BLACK)
        self.mdc.SetPen(pen)
        text_w = max([self.mdc.GetTextExtent(_i[0])[0] for _i in ticks])
        for tick in ticks:
            # Sorry, everything is measured from right to left...
            tick_end = self.grad_start_x - self.spacer
            tick_start = tick_end - self.tick_w
            self.mdc.DrawLine(tick_start, tick[2],
                              tick_end, tick[2])

            # Text origin is top left of bounding box.
            # Text is currently left-aligned. Maybe Change?
            text_x = tick_start - self.spacer - text_w
            text_y = tick[2] - self.text_h / 2
            self.mdc.DrawText(tick[0], text_x, text_y) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:25,代码来源:wm_legend.py

示例6: draw_background

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
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) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:19,代码来源:wm_legend.py

示例7: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [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

示例8: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [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

示例9: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [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

示例10: OnPaint

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def OnPaint(self, evt):
        # this doesnt appear to work at all...
        width,height = self.GetSizeTuple()

        # get drawing canvas
        dc = wx.PaintDC(self)

        dc.SetPen(wx.Pen(wx.Colour(0,0,255,255)))
        dc.SetBrush(wx.Brush(wx.Colour(0,0,255,220)))

        # build rect
        size = max(2, (width-10)*self.progress)
        rect = wx.Rect(5,8, size ,5)

        # draw rect
        dc.Clear()
        dc.BeginDrawing()
        dc.DrawRoundedRectangleRect(rect, 2)
        dc.EndDrawing() 
开发者ID:collingreen,项目名称:chronolapse,代码行数:21,代码来源:chronolapse.py

示例11: OnPaint

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def OnPaint(self, evt):
        # this doesnt appear to work at all...

        width,height = self.GetSizeTuple()

        # get drawing shit
        dc = wx.PaintDC(self)

        dc.SetPen(wx.Pen(wx.Colour(0,0,255,255)))
        dc.SetBrush(wx.Brush(wx.Colour(0,0,255,220)))

        # build rect
        size = max(2, (width-10)*self.progress)
        rect = wx.Rect(5,8, size ,5)

        # draw rect
        dc.Clear()
        dc.BeginDrawing()
        dc.DrawRoundedRectangleRect(rect, 2)
        dc.EndDrawing()
# end wxGlade 
开发者ID:collingreen,项目名称:chronolapse,代码行数:23,代码来源:chronolapsegui.py

示例12: draw_sort_arrow

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def draw_sort_arrow(self, direction):
        b = wx.EmptyBitmap(self.icon_size, self.icon_size)
        w, h = b.GetSize()
        ho = (h - 5) / 2
        dc = wx.MemoryDC()
        dc.SelectObject(b)
        colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_GRAYTEXT)
        dc.SetBackgroundMode(wx.TRANSPARENT)
        dc.Clear()
        dc.SetPen(wx.Pen(colour))
        for i in xrange(5):
            if direction == 'down':
                j = 4 - i
            else:
                j = i
            dc.DrawLine(i,j+ho,9-i,j+ho)
        dc.SelectObject(wx.NullBitmap)
        b.SetMask(wx.Mask(b, (255, 255, 255)))
        return b 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:21,代码来源:ListCtrl.py

示例13: Draw

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def Draw(
        self,
        dc,
        foregroundColour,
        backgroundColour,
        coverage,
        aspectRatio=0,
        display=0, # deprecated
    ):
        dc.SetBackground(wx.Brush(backgroundColour))
        dc.Clear()
        dc.SetPen(wx.Pen(foregroundColour, 1))
        dc.SetBrush(wx.Brush(foregroundColour))
        dc.SetPen(wx.Pen(foregroundColour, 1))
        dc.SetBrush(wx.Brush(foregroundColour))
        w, h = dc.GetSizeTuple()
        area = (w * h) * coverage / 100
        width = height = sqrt(area)
        dc.DrawRectangle((w - width) / 2, (h - height) / 2, width, height) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:21,代码来源:__init__.py

示例14: _cycleidxs

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def _cycleidxs(indexcount, maxvalue, step):

    """
    Utility function used by _colorGenerator
    """
    def colormatch(color):
        """Return True if the color comes back from the bitmap identically."""
        if len(color) < 3:
            return True
        global _testBitmap
        dc = wx.MemoryDC()
        if not _testBitmap:
            _testBitmap = wx.Bitmap(1, 1)
        dc.SelectObject(_testBitmap)
        dc.SetBackground(wx.BLACK_BRUSH)
        dc.Clear()
        dc.SetPen(wx.Pen(wx.Colour(*color), 4))
        dc.DrawPoint(0,0)
        if mac: # NOTE: can the Mac not just use the DC?
            del dc # Mac can't work with bitmap when selected into a DC.
            pdata = wx.AlphaPixelData(_testBitmap)
            pacc = pdata.GetPixels()
            pacc.MoveTo(pdata, 0, 0)
            outcolor = pacc.Get()[:3]
        else:
            outcolor = dc.GetPixel(0,0)
        return outcolor == color
 
    if indexcount == 0:
        yield ()
    else:
        for idx in range(0, maxvalue, step):
            for tail in _cycleidxs(indexcount - 1, maxvalue, step):
                color = (idx, ) + tail
                if not colormatch(color):
                    continue
                yield color 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:39,代码来源:FCObjects.py

示例15: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Pen [as 别名]
def __init__(self, InForeground  = False, IsVisible = True):
        """
        Default class constructor.
        
        :param boolean `InForeground`: Define if object should be in foreground
         or not
        :param boolean `IsVisible`: Define if object should be visible
          
        """
        self.InForeground = InForeground

        self._Canvas = None

        self.HitColor = None
        self.CallBackFuncs = {}

        ## these are the defaults
        self.HitAble = False
        self.HitLine = True
        self.HitFill = True
        self.MinHitLineWidth = 3
        self.HitLineWidth = 3 ## this gets re-set by the subclasses if necessary

        self.Brush = None
        self.Pen = None

        self.FillStyle = "Solid"

        self.Visible = IsVisible

    # I pre-define all these as class variables to provide an easier
    # interface, and perhaps speed things up by caching all the Pens
    # and Brushes, although that may not help, as I think wx now
    # does that on it's own. Send me a note if you know! 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:36,代码来源:FCObjects.py


注:本文中的wx.Pen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。