本文整理汇总了Python中wx.BufferedPaintDC方法的典型用法代码示例。如果您正苦于以下问题:Python wx.BufferedPaintDC方法的具体用法?Python wx.BufferedPaintDC怎么用?Python wx.BufferedPaintDC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.BufferedPaintDC方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NextFrame
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def NextFrame(self, event):
# acquire new frame, ignore timestamp
frame,_ = freenect.sync_get_depth()
# clip max depth to 1023, convert to 8-bit grayscale
np.clip(frame, 0, 2**10 - 1, frame)
frame >>= 2
frame = frame.astype(np.uint8)
# segment hand, detect number of fingers, return
# annotated RGB image
frame = self.ProcessFrame(frame)
# update buffer and paint
self.bmp.CopyFromBuffer(frame)
deviceContext = wx.BufferedPaintDC(self.pnl)
deviceContext.DrawBitmap(self.bmp, 0, 0)
del deviceContext
示例2: _on_paint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def _on_paint(self, event):
"""
This method draws the camera frame stored in the bitmap self.bmp
onto the panel self.pnl. Make sure self.pnl exists and is at least
the size of the camera frame.
This method is called whenever an event wx.EVT_PAINT is triggered.
"""
# read and draw buffered bitmap
deviceContext = wx.BufferedPaintDC(self.pnl)
deviceContext.DrawBitmap(self.bmp, 0, 0)
示例3: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, event):
dc = wx.BufferedPaintDC(self, self._buffer)
示例4: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, evt):
dc = wx.BufferedPaintDC(self)
dc.DrawBitmap(self.bmp, 0, 0)
# self.display(sal,style('image'))
示例5: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, event):
dc = wx.BufferedPaintDC(self, self.buffer)
示例6: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, event):
dc = wx.BufferedPaintDC(self)
dc.DrawBitmap(self.bmp, 0, 0)
示例7: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, dummyEvent=None):
wx.BufferedPaintDC(self, self.bitmap)
示例8: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, event=None):
wx.BufferedPaintDC(self, self._buffer)
示例9: on_paint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def on_paint(self, event):
try:
wx.BufferedPaintDC(self.display_camera, self._Buffer)
except RuntimeError:
pass
示例10: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, event):
dc = self.GetLogicalDC(True)
self.DoDrawing(dc)
wx.BufferedPaintDC(self.Editor, dc.GetAsBitmap())
if self.Debug:
DebugViewer.RefreshNewData(self)
event.Skip()
示例11: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, event):
"""Paint the canvas to the screen."""
# Blit the front buffer to the screen
wx.BufferedPaintDC(self, self.buffer)
示例12: __on_paint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def __on_paint(self, _event):
pdc = wx.BufferedPaintDC(self)
try:
dc = wx.GCDC(pdc)
except:
dc = pdc
w, h = self.GetClientSize()
font = self.GetFont()
font.SetPixelSize((0, h - (TICK_SIZE_MAJ * 2)))
dc.SetFont(font)
dc.SetPen(wx.Pen(wx.WHITE))
dc.SetBrush(wx.Brush(wx.WHITE))
dc.DrawRectangle(0, 0, w, h)
colour = '#4DDB4D' if self._value >= self._threshold else '#FF4D4D'
dc.SetPen(wx.Pen(colour))
dc.SetBrush(wx.Brush(colour))
x = self.__scale_x(self._value, w)
dc.DrawRectangle(0, 0, x, h)
colour = wx.Colour(0x80, 0x80, 0xFF, 128)
dc.SetPen(wx.Pen(colour, 2))
dc.SetBrush(wx.Brush(colour))
x = round(self.__scale_x(self._threshold, w))
dc.DrawPolygon([(x - THRES_SIZE, 0),
(x + THRES_SIZE, 0),
(x, THRES_SIZE)])
dc.DrawPolygon([(x - THRES_SIZE, h),
(x + THRES_SIZE, h),
(x, h - THRES_SIZE)])
dc.DrawLine(x, THRES_SIZE, x, h - THRES_SIZE)
if self._noise is not None:
dc.SetPen(wx.Pen('#8080FF', 1))
x = self.__scale_x(self._noise, w)
dc.DrawRectangle(0, TICK_SIZE_MAJ * 3 / 2.,
x, h - (TICK_SIZE_MAJ * 3))
colour = wx.Colour(0x4d, 0x4d, 0x4d)
dc.SetPen(wx.Pen(colour))
dc.SetTextForeground(colour)
ticks = range(LEVEL_MIN, LEVEL_MAX, 10)
for tick in ticks:
if tick not in [LEVEL_MIN, LEVEL_MAX]:
x = self.__scale_x(tick, w)
dc.DrawLine(x, 0, x, TICK_SIZE_MAJ)
dc.DrawLine(x, h, x, h - TICK_SIZE_MAJ)
label = str(tick)
tW, tH = dc.GetTextExtent(label)
dc.DrawText(label, x - tW / 2, (h - tH) / 2)
ticks = range(LEVEL_MIN, LEVEL_MAX, 1)
for tick in ticks:
if tick not in [LEVEL_MIN, LEVEL_MAX]:
x = self.__scale_x(tick, w)
dc.DrawLine(x, 0, x, TICK_SIZE_MIN)
dc.DrawLine(x, h, x, h - TICK_SIZE_MIN)
示例13: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, event):
dc = wx.BufferedPaintDC(self, self.screenBuf)
size = self.GetClientSize()
dc.SetBrush(wx.WHITE_BRUSH)
dc.SetPen(wx.WHITE_PEN)
dc.DrawRectangle(0, 0, size.width, size.height)
dc.SetPen(wx.BLACK_PEN)
dc.SetTextForeground(wx.BLACK)
for y in range(self.rows + 1):
util.drawLine(dc, self.offset, self.offset + y * self.cellSize,
self.cols * self.cellSize + 1, 0)
for x in range(self.cols + 1):
util.drawLine(dc, self.offset + x * self.cellSize,
self.offset, 0, self.rows * self.cellSize)
dc.SetFont(self.normalFont)
for y in range(self.rows):
for x in range(self.cols):
i = y * self.cols + x
if i < len(self.chars):
util.drawText(dc, self.chars[i],
x * self.cellSize + self.offset + self.cellSize // 2 + 1,
y * self.cellSize + self.offset + self.cellSize // 2 + 1,
util.ALIGN_CENTER, util.VALIGN_CENTER)
y = self.offset + self.rows * self.cellSize
pad = 5
if self.selected:
code = ord(self.selected)
self.drawCharBox(dc, "Selected:", self.selected, self.offset,
y + pad, 75)
c = util.upper(self.selected)
if c == self.selected:
c = util.lower(self.selected)
if c == self.selected:
c = None
if c:
self.drawCharBox(dc, "Opposite case:", c, self.offset + 150,
y + pad, 110)
dc.SetFont(self.smallFont)
dc.DrawText("Character code: %d" % code, 360, y + pad)
if code == 32:
dc.DrawText("Normal space", 360, y + pad + 30)
elif code == 160:
dc.DrawText("Non-breaking space", 360, y + pad + 30)
else:
dc.SetFont(self.smallFont)
dc.DrawText("Click on a character to select it.", self.offset,
y + pad)
示例14: OnPaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def OnPaint(self, event):
dc = wx.BufferedPaintDC(self)
dc.Clear()
dc.BeginDrawing()
gc = wx.GCDC(dc)
width, height = self.GetClientSize()
gc.SetPen(wx.Pen(wx.NamedColour("GREY"), 3))
gc.SetBrush(wx.GREY_BRUSH)
gc.DrawLines(ArrowPoints(wx.TOP, width * 0.75, width * 0.5, 2, (width + height) // 4 - 3))
gc.DrawLines(ArrowPoints(wx.TOP, width * 0.75, width * 0.5, 2, (width + height) // 4 + 3))
gc.DrawLines(ArrowPoints(wx.BOTTOM, width * 0.75, width * 0.5, 2, (height * 3 - width) // 4 + 3))
gc.DrawLines(ArrowPoints(wx.BOTTOM, width * 0.75, width * 0.5, 2, (height * 3 - width) // 4 - 3))
thumb_rect = self.GetThumbRect()
exclusion_rect = wx.Rect(thumb_rect.x, thumb_rect.y,
thumb_rect.width, thumb_rect.height)
if self.Parent.IsMessagePanelTop():
exclusion_rect.y, exclusion_rect.height = width, exclusion_rect.y + exclusion_rect.height - width
if self.Parent.IsMessagePanelBottom():
exclusion_rect.height = height - width - exclusion_rect.y
if exclusion_rect != thumb_rect:
colour = wx.NamedColour("LIGHT GREY")
gc.SetPen(wx.Pen(colour))
gc.SetBrush(wx.Brush(colour))
gc.DrawRectangle(exclusion_rect.x, exclusion_rect.y,
exclusion_rect.width, exclusion_rect.height)
gc.SetPen(wx.GREY_PEN)
gc.SetBrush(wx.GREY_BRUSH)
gc.DrawPolygon(ArrowPoints(wx.TOP, width, width, 0, 0))
gc.DrawPolygon(ArrowPoints(wx.BOTTOM, width, width, 0, height))
gc.DrawRectangle(thumb_rect.x, thumb_rect.y,
thumb_rect.width, thumb_rect.height)
dc.EndDrawing()
event.Skip()
示例15: GetNearestPointInLayer
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedPaintDC [as 别名]
def GetNearestPointInLayer(self, layer, pt):
"""Determine if clicked location selects a point in layer data.
layer layer object we are looking in
pt click geo location (lon, lat) or screen (x, y)
Return None (no selection) or ((x, y), data) of closest point.
"""
# TODO: speed this up? Do we need to??
# http://en.wikipedia.org/wiki/Kd-tree
# would need to create kd-tree in AddLayer()
(ptx, pty) = pt
res = None
dist = 9999999.0 # more than possible
if layer.map_rel:
for p in layer.data:
(x, y, _, _, _, _, _, data) = p
d = (x - ptx) * (x - ptx) + (y - pty) * (y - pty)
if d < dist:
dist = d
res = ((x, y), data)
if dist <= layer.delta:
return res
else:
for p in layer.data:
dc = wx.BufferedPaintDC(self, self.buffer)
(dc_w, dc_h) = dc.GetSize()
dc_w2 = dc_w / 2 # noqa; lgtm; self-modifying code
dc_h2 = dc_h / 2 # noqa; lgtm; self-modifying code
dc_h -= 1
dc_w -= 1
(x, y, place, _, _, x_off, y_off, pdata) = p
exec(self.point_view_placement[place])
d = (x - ptx) * (x - ptx) + (y - pty) * (y - pty)
if d < dist:
dist = d
res = ((x, y), pdata)
if dist <= layer.delta:
return res
return None