本文整理匯總了Python中wx.Overlay方法的典型用法代碼示例。如果您正苦於以下問題:Python wx.Overlay方法的具體用法?Python wx.Overlay怎麽用?Python wx.Overlay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wx
的用法示例。
在下文中一共展示了wx.Overlay方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: press
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Overlay [as 別名]
def press(self, event):
if self._active == 'ZOOM':
if not self.retinaFix:
self.wxoverlay = wx.Overlay()
else:
if event.inaxes is not None:
self.savedRetinaImage = self.canvas.copy_from_bbox(
event.inaxes.bbox)
self.zoomStartX = event.xdata
self.zoomStartY = event.ydata
self.zoomAxes = event.inaxes
示例2: draw_rubberband
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Overlay [as 別名]
def draw_rubberband(self, x0, y0, x1, y1):
# Use an Overlay to draw a rubberband-like bounding box.
if self.wxoverlay is None:
self.wxoverlay = wx.Overlay()
dc = wx.ClientDC(self.canvas)
odc = wx.DCOverlay(self.wxoverlay, dc)
odc.Clear()
dc = wx.GCDC(dc)
height = self.canvas.figure.bbox.height
y1 = height - y1
y0 = height - y0
if y1 < y0:
y0, y1 = y1, y0
if x1 < x0:
x0, x1 = x1, x0
w = x1 - x0
h = y1 - y0
rect = wx.Rect(x0, y0, w, h)
rubberBandColor = '#C0C0FF' # or load from config?
# Set a pen for the border
color = wx.Colour(rubberBandColor)
dc.SetPen(wx.Pen(color, 1))
# use the same color, plus alpha for the brush
r, g, b, a = color.Get(True)
color.Set(r, g, b, 0x60)
dc.SetBrush(wx.Brush(color))
dc.DrawRectangle(rect)
示例3: press
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Overlay [as 別名]
def press(self, event):
if self._active == 'ZOOM':
self.wxoverlay = wx.Overlay()
示例4: draw_rubberband
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Overlay [as 別名]
def draw_rubberband(self, event, x0, y0, x1, y1):
# Use an Overlay to draw a rubberband-like bounding box.
dc = wx.ClientDC(self.canvas)
odc = wx.DCOverlay(self.wxoverlay, dc)
odc.Clear()
# Mac's DC is already the same as a GCDC, and it causes
# problems with the overlay if we try to use an actual
# wx.GCDC so don't try it.
if 'wxMac' not in wx.PlatformInfo:
dc = wx.GCDC(dc)
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 = wx.Rect(x0, y0, w, h)
rubberBandColor = '#C0C0FF' # or load from config?
# Set a pen for the border
color = wx.NamedColour(rubberBandColor)
dc.SetPen(wx.Pen(color, 1))
# use the same color, plus alpha for the brush
r, g, b = color.Get()
color.Set(r,g,b, 0x60)
dc.SetBrush(wx.Brush(color))
dc.DrawRectangleRect(rect)
示例5: draw_rubberband
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Overlay [as 別名]
def draw_rubberband(self, x0, y0, x1, y1):
# Use an Overlay to draw a rubberband-like bounding box.
if self.wxoverlay is None:
self.wxoverlay = wx.Overlay()
dc = wx.ClientDC(self.canvas)
odc = wx.DCOverlay(self.wxoverlay, dc)
odc.Clear()
dc = wx.GCDC(dc)
height = self.canvas.figure.bbox.height
y1 = height - y1
y0 = height - y0
if y1 < y0:
y0, y1 = y1, y0
if x1 < x0:
x0, x1 = x1, x0
w = x1 - x0
h = y1 - y0
rect = wx.Rect(x0, y0, w, h)
rubberBandColor = '#C0C0FF' # or load from config?
# Set a pen for the border
color = wxc.NamedColour(rubberBandColor)
dc.SetPen(wx.Pen(color, 1))
# use the same color, plus alpha for the brush
r, g, b, a = color.Get(True)
color.Set(r, g, b, 0x60)
dc.SetBrush(wx.Brush(color))
if wxc.is_phoenix:
dc.DrawRectangle(rect)
else:
dc.DrawRectangleRect(rect)