本文整理汇总了Python中wx.SOLID属性的典型用法代码示例。如果您正苦于以下问题:Python wx.SOLID属性的具体用法?Python wx.SOLID怎么用?Python wx.SOLID使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.SOLID属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _Draw
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None):
XY = WorldToPixel(self.XY)
dc.SetFont(self.Font)
dc.SetTextForeground(self.Color)
if self.BackgroundColor:
dc.SetBackgroundMode(wx.SOLID)
dc.SetTextBackground(self.BackgroundColor)
else:
dc.SetBackgroundMode(wx.TRANSPARENT)
if self.TextWidth is None or self.TextHeight is None:
(self.TextWidth, self.TextHeight) = dc.GetTextExtent(self.String)
XY = self.ShiftFun(XY[0], XY[1], self.TextWidth, self.TextHeight)
dc.DrawText(self.String, XY)
if HTdc and self.HitAble:
HTdc.SetPen(self.HitPen)
HTdc.SetBrush(self.HitBrush)
HTdc.DrawRectangle(XY, (self.TextWidth, self.TextHeight) )
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [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
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [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
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [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
示例5: on_paint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [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)
示例6: DrawHighlightment
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def DrawHighlightment(self, dc):
scalex, scaley = dc.GetUserScale()
dc.SetUserScale(1, 1)
dc.SetPen(MiterPen(HIGHLIGHTCOLOR, (3 * scalex + 5), wx.SOLID))
dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.SetLogicalFunction(wx.AND)
# Draw a two circle arcs for representing the coil
dc.DrawEllipticArc(round(self.Pos.x * scalex),
round((self.Pos.y - int(self.Size[1] * (sqrt(2) - 1.) / 2.) + 1) * scaley),
round(self.Size[0] * scalex),
round((int(self.Size[1] * sqrt(2)) - 1) * scaley),
135, 225)
dc.DrawEllipticArc(round(self.Pos.x * scalex),
round((self.Pos.y - int(self.Size[1] * (sqrt(2) - 1.) / 2.) + 1) * scaley),
round(self.Size[0] * scalex),
round((int(self.Size[1] * sqrt(2)) - 1) * scaley),
-45, 45)
dc.SetLogicalFunction(wx.COPY)
dc.SetUserScale(scalex, scaley)
# Adds an highlight to the connection
示例7: draw_rubberband
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def draw_rubberband(self, x0, y0, x1, y1):
dc = wx.ClientDC(self.canvas)
# this would be required if the Canvas is a ScrolledWindow,
# which is not the case for now
# self.PrepareDC(dc)
# delete old rubberband
if self._rect:
self.remove_rubberband(dc)
# draw new rubberband
dc.SetPen(wx.Pen(wx.BLACK, 1, wx.SOLID))
dc.SetBrush(wx.TRANSPARENT_BRUSH)
self._rect = (x0, self.canvas._height-y0, x1-x0, -y1+y0)
if wxc.is_phoenix:
dc.DrawRectangle(self._rect)
else:
dc.DrawRectangleRect(self._rect)
示例8: draw
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def draw(self, dc):
color = 'green'
if not self.is_finished:
color = 'yellow'
if self.is_failed:
color = 'red'
dc.SetBrush(wx.Brush(color, wx.SOLID))
dc.DrawCircle(self.x, self.y, 20)
示例9: _Draw
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def _Draw(self, dc, Canvas):
"""
_Draw method for Overlay.
.. note::
This is a differeent signarture than the DrawObject Draw
"""
dc.SetFont(self.Font)
dc.SetTextForeground(self.Color)
if self.BackgroundColor:
dc.SetBackgroundMode(wx.SOLID)
dc.SetTextBackground(self.BackgroundColor)
else:
dc.SetBackgroundMode(wx.TRANSPARENT)
dc.DrawTextPoint(self.String, self.XY)
示例10: draw_rubberband
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def draw_rubberband(self, event, x0, y0, x1, y1):
'adapted from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/189744'
canvas = self.canvas
dc =wx.ClientDC(canvas)
# Set logical function to XOR for rubberbanding
dc.SetLogicalFunction(wx.XOR)
# Set dc brush and pen
# Here I set brush and pen to white and grey respectively
# You can set it to your own choices
# The brush setting is not really needed since we
# dont do any filling of the dc. It is set just for
# the sake of completion.
wbrush =wx.Brush(wx.Colour(255,255,255), wx.TRANSPARENT)
wpen =wx.Pen(wx.Colour(200, 200, 200), 1, wx.SOLID)
dc.SetBrush(wbrush)
dc.SetPen(wpen)
dc.ResetBoundingBox()
dc.BeginDrawing()
height = self.canvas.figure.bbox.height
y1 = height - y1
y0 = height - y0
if y1<y0: y0, y1 = y1, y0
if x1<y0: x0, x1 = x1, x0
w = x1 - x0
h = y1 - y0
rect = int(x0), int(y0), int(w), int(h)
try: lastrect = self.lastrect
except AttributeError: pass
else: dc.DrawRectangle(*lastrect) #erase last
self.lastrect = rect
dc.DrawRectangle(*rect)
dc.EndDrawing()
示例11: draw_rubberband
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def draw_rubberband(self, x0, y0, x1, y1):
dc = wx.ClientDC(self.canvas)
# this would be required if the Canvas is a ScrolledWindow,
# which is not the case for now
# self.PrepareDC(dc)
# delete old rubberband
if self._rect:
self.remove_rubberband(dc)
# draw new rubberband
dc.SetPen(wx.Pen(wx.BLACK, 1, wx.SOLID))
dc.SetBrush(wx.TRANSPARENT_BRUSH)
self._rect = (x0, self.canvas._height-y0, x1-x0, -y1+y0)
dc.DrawRectangle(self._rect)
示例12: OnDraw
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def OnDraw(self, dc):
if self._lineControlPoints:
dc.SetPen(wx.ThePenList.FindOrCreatePen(wx.BLACK, 1, wx.SOLID))
dc.SetBrush(wx.TheBrushList.FindOrCreateBrush(wx.LIGHT_GREY, wx.SOLID))
p0x,p0y=self.startPoint
p3x,p3y=self.endPoint
xd=(p3x-p0x)/3.
p1x = p0x + xd-8
p2x = p3x - xd+8
width=self.width
phi = math.atan2(p3y - p0y, p2x - p1x)
offs = -width * math.tan(phi/2)
arrow=4
points=[]
def append(x, y):
points.append( (round(x), round(y)))
append(p0x, p0y-width)
append(p1x-offs, p0y-width)
append(p2x-offs-arrow, p3y-width)
append(p3x-width-arrow, p3y-width)
append(p3x-width-arrow, p3y-width-arrow)
append(p3x, p3y)
append(p3x-width-arrow, p3y+width+arrow)
append(p3x-width-arrow, p3y+width)
append(p2x+offs-arrow, p3y+width)
append(p1x+offs, p0y+width)
append(p0x, p0y+width)
dc.DrawPolygon(points, 0, 0)
示例13: Plotting_Test
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def Plotting_Test(self):
#--------------------------------------------------------
# Note: We may need to save the window's bitmap in a
# buffer and refresh it on certain events.
# As it stands now, moving the cursor to another
# window causes window contents to be lost,
# even if we use the Freeze() method.
#--------------------------------------------------------
window = self.plot_window
nx = self.window_nx
ny = self.window_ny
# win_buffer = self.plot_buffer
win_buffer = wx.EmptyBitmap(nx,ny)
#---------------------------------------------
# Create a device context (don't store them)
#---------------------------------------------
dc = wx.BufferedDC(wx.ClientDC(window))
## dc = wx.BufferedDC(wx.ClientDC(window), win_buffer)
## dc = wx.ClientDC(window) # (also works)
## dc = wx.WindowDC(window) # (also works)
pen = wx.Pen("black", 2, wx.SOLID)
brush = wx.Brush("white", wx.SOLID) # (for filling in areas)
dc.SetPen(pen)
dc.SetBrush(brush)
dc.SetBackground(brush)
dc.Clear()
#------------------------------------------
dc.DrawRectangle(0,0,nx,ny)
dc.DrawLine(0,0,nx,ny)
dc.DrawCircle(nx/2,ny/2, nx/3)
# print 'dc.GetSize() =', dc.GetSize()
## window.Freeze() # (see also window.Thaw() )
## window.Disable()
# Plotting_Test()
#----------------------------------------------------------------
示例14: MiterPen
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def MiterPen(colour, width=1, style=wx.SOLID):
pen = wx.Pen(colour, width, style)
pen.SetJoin(wx.JOIN_MITER)
pen.SetCap(wx.CAP_PROJECTING)
return pen
# -------------------------------------------------------------------------------
# Helpers for highlighting text
# -------------------------------------------------------------------------------
示例15: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import SOLID [as 别名]
def __init__(
self, parent=None, id=-1, pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.TAB_TRAVERSAL|wx.NO_BORDER|wx.FULL_REPAINT_ON_RESIZE,
name='SquareMap', model = None,
adapter = None,
labels = True,
highlight = True,
padding = 2,
margin = 0,
square_style = False,
):
"""Initialise the SquareMap
adapter -- a DefaultAdapter or same-interface instance providing SquareMap data api
labels -- set to True (default) to draw textual labels within the boxes
highlight -- set to True (default) to highlight nodes on mouse-over
padding -- spacing within each square and its children (within the square's border)
margin -- spacing around each square (on all sides)
square_style -- use a more-recursive, less-linear, more "square" layout style which
works better on objects with large numbers of children, such as Meliae memory
dumps, works fine on profile views as well, but the layout is less obvious wrt
what node is "next" "previous" etc.
"""
super( SquareMap, self ).__init__(
parent, id, pos, size, style, name
)
self.model = model
self.padding = padding
self.square_style = square_style
self.margin = margin
self.labels = labels
self.highlight = highlight
self.selectedNode = None
self.highlightedNode = None
self._buffer = wx.EmptyBitmap(20, 20) # Have a default buffer ready
self.Bind( wx.EVT_PAINT, self.OnPaint)
self.Bind( wx.EVT_SIZE, self.OnSize )
if highlight:
self.Bind( wx.EVT_MOTION, self.OnMouse )
self.Bind( wx.EVT_LEFT_UP, self.OnClickRelease )
self.Bind( wx.EVT_LEFT_DCLICK, self.OnDoubleClick )
self.Bind( wx.EVT_KEY_UP, self.OnKeyUp )
self.hot_map = []
self.adapter = adapter or DefaultAdapter()
self.DEFAULT_PEN = wx.Pen( wx.BLACK, 1, wx.SOLID )
self.SELECTED_PEN = wx.Pen( wx.WHITE, 2, wx.SOLID )
self.OnSize(None)