pythonwx文档蹦的笔_Python wx.Pen方法代码示例

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

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

示例1: SetPen

​点赞 6

# 需要导入模块: 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,

示例2: SetUpDraw

​点赞 6

# 需要导入模块: 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,

示例3: _Draw

​点赞 6

# 需要导入模块: 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,

示例4: _DC_DrawPointList

​点赞 6

# 需要导入模块: 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,

示例5: draw_ticks

​点赞 6

# 需要导入模块: 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,

示例6: draw_background

​点赞 6

# 需要导入模块: 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,

示例7: __init__

​点赞 6

# 需要导入模块: 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,

示例8: __init__

​点赞 6

# 需要导入模块: 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,

示例9: __init__

​点赞 6

# 需要导入模块: 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,

示例10: OnPaint

​点赞 6

# 需要导入模块: 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,

示例11: OnPaint

​点赞 6

# 需要导入模块: 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,

示例12: draw_sort_arrow

​点赞 6

# 需要导入模块: 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,

示例13: Draw

​点赞 6

# 需要导入模块: 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,

示例14: _cycleidxs

​点赞 5

# 需要导入模块: 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,

示例15: __init__

​点赞 5

# 需要导入模块: 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,

示例16: SetHitPen

​点赞 5

# 需要导入模块: import wx [as 别名]

# 或者: from wx import Pen [as 别名]

def SetHitPen(self, HitColor, LineWidth):

"""

Set the pen used for hit test, do not call directly.

:param `HitColor`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetColor`

:param integer `LineWidth`: the line width in pixels

"""

if not self.HitLine:

self.HitPen = wx.TRANSPARENT_PEN

else:

self.HitPen = self.PenList.setdefault( (HitColor, "solid", self.HitLineWidth), wx.Pen(HitColor, self.HitLineWidth, self.LineStyleList["Solid"]) )

## Just to make sure that they will always be there

## the appropriate ones should be overridden in the subclasses

开发者ID:dougthor42,项目名称:wafer_map,代码行数:17,

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值