本文整理汇总了Python中wx.TRANSPARENT_PEN属性的典型用法代码示例。如果您正苦于以下问题:Python wx.TRANSPARENT_PEN属性的具体用法?Python wx.TRANSPARENT_PEN怎么用?Python wx.TRANSPARENT_PEN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.TRANSPARENT_PEN属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SetPen
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_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]))
示例2: Render
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def Render(self, cell, dc, state):
position = cell.GetPosition()
for device in self._Devices:
box = self.GetTextExtent(device['name'])
RADIUS = DeviceListRenderer.CORNER_RADIUS
if device['vendor'] == 'nvidia':
color = self._ColorDb.Find('LIME GREEN')
else:
color = self._ColorDb.Find('LIGHT GREY')
dc.SetBrush(wx.Brush(color))
dc.SetPen(wx.TRANSPARENT_PEN)
shadeRect = wx.Rect(
position,
wx.Size(box.GetWidth() + RADIUS*2, box.GetHeight() + RADIUS*2))
dc.DrawRoundedRectangle(shadeRect, RADIUS)
textRect = wx.Rect(
wx.Point(position.x + RADIUS, position.y + RADIUS), box)
self.RenderText(device['name'], 0, textRect, dc, state)
position = wx.Point(
position.x, (position.y + box.GetHeight() + RADIUS*2 + RADIUS))
return True
示例3: DrawHighlightedText
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [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
# -------------------------------------------------------------------------------
示例4: PaintItem
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def PaintItem(self, item, dc, level, align):
CT.CustomTreeCtrl.PaintItem(self, item, dc, level, align)
rightimages = item.GetRightImages()
if len(rightimages) > 0:
images_bbx = self.GetItemRightImagesBBox(item)
r_image_w, _r_image_h = self._imageListRight.GetSize(rightimages[0])
dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.SetPen(wx.TRANSPARENT_PEN)
dc.DrawRectangle(images_bbx.x, images_bbx.y,
images_bbx.width, images_bbx.height)
x_pos = images_bbx.x + 4
for r_image in rightimages:
self._imageListRight.Draw(
r_image, dc, x_pos, images_bbx.y + 4,
wx.IMAGELIST_DRAW_TRANSPARENT)
x_pos += r_image_w + 4
示例5: DrawDecoration
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def DrawDecoration(self, dc, bounds, block):
"""
Draw this decoration
"""
rect = self._CalculateRect(bounds)
if self.color:
if self.toColor is None:
dc.SetPen(wx.TRANSPARENT_PEN)
dc.SetBrush(wx.Brush(self.color))
dc.DrawRectangle(*rect)
else:
dc.GradientFillLinear(wx.Rect(*rect), self.color, self.toColor)
if self.pen:
dc.SetPen(self.pen)
dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.DrawRectangle(*rect)
示例6: SetHitPen
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_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
示例7: draw_bar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def draw_bar(self, dc, rect):
if self.percent == None:
return 0
dc.SetPen(wx.TRANSPARENT_PEN)
dc.SetBrush(wx.Brush(self.remaining_color))
dc.DrawRectangle(rect.x, rect.y,
rect.width, rect.height)
dc.SetBrush(wx.Brush(self.completed_color))
dc.DrawRectangle(rect.x, rect.y,
rect.width * self.percent, rect.height)
return 0
示例8: OnEraseBackground
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def OnEraseBackground(self, event=None):
nsp = self.GetScrollPos(wx.VERTICAL)
if self._last_scrollpos != nsp:
self._last_scrollpos = nsp
# should only refresh visible items, hmm
wx.CallAfter(self.Refresh)
dc = wx.ClientDC(self)
# erase the section of the background which is not covered by the
# items or the selected column highlighting
dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
f = self.GetRect()
r = wx.Region(0, 0, f.width, f.height)
x = self.GetVisibleViewRect()
offset = self._get_origin_offset(include_header=True)
x.Offset(offset)
r.SubtractRect(x)
if '__WXMSW__' in wx.PlatformInfo:
c = self.GetColumnRect(self.enabled_columns.index(self.selected_column))
r.SubtractRect(c)
dc.SetClippingRegionAsRegion(r)
dc.Clear()
if '__WXMSW__' in wx.PlatformInfo:
# draw the selected column highlighting under the items
dc.DestroyClippingRegion()
r = wx.Region(0, 0, f.width, f.height)
r.SubtractRect(x)
dc.SetClippingRegionAsRegion(r)
dc.SetPen(wx.TRANSPARENT_PEN)
hc = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
r = highlight_color(hc.Red())
g = highlight_color(hc.Green())
b = highlight_color(hc.Blue())
hc.Set(r, g, b)
dc.SetBrush(wx.Brush(hc))
dc.DrawRectangle(c.x, c.y, c.width, c.height)
示例9: set_pen
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def set_pen(self, gc, stroke, width=1.0):
c = stroke
if c is not None and c != 'none':
swizzle_color = swizzlecolor(c)
self.color.SetRGB(swizzle_color)
self.pen.SetColour(self.color)
self.pen.SetWidth(width)
gc.SetPen(self.pen)
else:
gc.SetPen(wx.TRANSPARENT_PEN)
示例10: RefreshScaling
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def RefreshScaling(self, refresh=True):
properties = self.Controler.GetProjectProperties(self.Debug)
scaling = properties["scaling"][self.CurrentLanguage]
if scaling[0] != 0 and scaling[1] != 0:
self.Scaling = scaling
if self.DrawGrid:
width = max(2, int(scaling[0] * self.ViewScale[0]))
height = max(2, int(scaling[1] * self.ViewScale[1]))
bitmap = wx.EmptyBitmap(width, height)
dc = wx.MemoryDC(bitmap)
dc.SetBackground(wx.Brush(self.Editor.GetBackgroundColour()))
dc.Clear()
dc.SetPen(MiterPen(wx.Colour(180, 180, 180)))
dc.DrawPoint(0, 0)
self.GridBrush = wx.BrushFromBitmap(bitmap)
else:
self.GridBrush = wx.TRANSPARENT_BRUSH
else:
self.Scaling = None
self.GridBrush = wx.TRANSPARENT_BRUSH
page_size = properties["pageSize"]
if page_size != (0, 0):
self.PageSize = map(int, page_size)
self.PagePen = MiterPen(wx.Colour(180, 180, 180))
else:
self.PageSize = None
self.PagePen = wx.TRANSPARENT_PEN
if refresh:
self.RefreshVisibleElements()
self.Editor.Refresh(False)
# -------------------------------------------------------------------------------
# Refresh functions
# -------------------------------------------------------------------------------
示例11: Draw
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def Draw(self, dc):
dc.SetPen(wx.TRANSPARENT_PEN)
dc.SetBrush(wx.Brush(wx.NamedColour("LIGHT GREY")))
dc.DrawRectangle(self.Position.x, self.Position.y,
self.Size.width, self.Size.height)
w, h = dc.GetTextExtent(self.Label)
dc.DrawText(self.Label,
self.Position.x + (self.Size.width - w) // 2,
self.Position.y + (self.Size.height - h) // 2)
示例12: DrawDecoration
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def DrawDecoration(self, dc, bounds, block):
"""
Draw this decoration
"""
if self.color is None:
return
dc.SetPen(wx.TRANSPARENT_PEN)
dc.SetBrush(wx.Brush(self.color))
dc.DrawRectangle(*bounds)
#----------------------------------------------------------------------------
示例13: DoDrawing
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TRANSPARENT_PEN [as 别名]
def DoDrawing(self, dc, printing=False):
if printing:
if getattr(dc, "printing", False):
font = wx.Font(self.GetFont().GetPointSize(), wx.MODERN, wx.NORMAL, wx.NORMAL)
dc.SetFont(font)
else:
dc.SetFont(self.GetFont())
else:
dc.SetBackground(wx.Brush(self.Editor.GetBackgroundColour()))
dc.Clear()
dc.BeginDrawing()
if self.Scaling is not None and self.DrawGrid and not printing:
dc.SetPen(wx.TRANSPARENT_PEN)
dc.SetBrush(self.GridBrush)
xstart, ystart = self.GetViewStart()
window_size = self.Editor.GetClientSize()
width, height = self.Editor.GetVirtualSize()
width = int(max(width, xstart * SCROLLBAR_UNIT + window_size[0]) / self.ViewScale[0])
height = int(max(height, ystart * SCROLLBAR_UNIT + window_size[1]) / self.ViewScale[1])
dc.DrawRectangle(1, 1, width, height)
if self.PageSize is not None and not printing:
dc.SetPen(self.PagePen)
xstart, ystart = self.GetViewStart()
window_size = self.Editor.GetClientSize()
if self.PageSize[0] != 0:
for x in xrange(self.PageSize[0] - (xstart * SCROLLBAR_UNIT) % self.PageSize[0], int(window_size[0] / self.ViewScale[0]), self.PageSize[0]):
dc.DrawLine(xstart * SCROLLBAR_UNIT + x + 1, int(ystart * SCROLLBAR_UNIT / self.ViewScale[0]),
xstart * SCROLLBAR_UNIT + x + 1, int((ystart * SCROLLBAR_UNIT + window_size[1]) / self.ViewScale[0]))
if self.PageSize[1] != 0:
for y in xrange(self.PageSize[1] - (ystart * SCROLLBAR_UNIT) % self.PageSize[1], int(window_size[1] / self.ViewScale[1]), self.PageSize[1]):
dc.DrawLine(int(xstart * SCROLLBAR_UNIT / self.ViewScale[0]), ystart * SCROLLBAR_UNIT + y + 1,
int((xstart * SCROLLBAR_UNIT + window_size[0]) / self.ViewScale[1]), ystart * SCROLLBAR_UNIT + y + 1)
# Draw all elements
for comment in self.Comments.itervalues():
if comment != self.SelectedElement and (comment.IsVisible() or printing):
comment.Draw(dc)
for wire in self.Wires.iterkeys():
if wire != self.SelectedElement and (wire.IsVisible() or printing):
if not self.Debug or not wire.GetValue():
wire.Draw(dc)
if self.Debug:
for wire in self.Wires.iterkeys():
if wire != self.SelectedElement and (wire.IsVisible() or printing) and wire.GetValue():
wire.Draw(dc)
for block in self.Blocks.itervalues():
if block != self.SelectedElement and (block.IsVisible() or printing):
block.Draw(dc)
if self.SelectedElement is not None and (self.SelectedElement.IsVisible() or printing):
self.SelectedElement.Draw(dc)
if not printing:
if self.Debug:
self.InstanceName.Draw(dc)
if self.rubberBand.IsShown():
self.rubberBand.Draw(dc)
dc.EndDrawing()