本文整理汇总了Python中wx.BufferedDC方法的典型用法代码示例。如果您正苦于以下问题:Python wx.BufferedDC方法的具体用法?Python wx.BufferedDC怎么用?Python wx.BufferedDC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.BufferedDC方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UpdateDrawing
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedDC [as 别名]
def UpdateDrawing(self):
dc = wx.BufferedDC(wx.ClientDC(self), self._buffer)
self.Draw(dc)
示例2: update
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedDC [as 别名]
def update(self, force=False):
if not self.IsShown() and not force:
return
dc = wx.BufferedDC(wx.ClientDC(self), self.buffer)
self.draw(dc, size = self.GetClientSize())
示例3: Plotting_Test
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedDC [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()
#----------------------------------------------------------------
示例4: UpdateDrawing
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedDC [as 别名]
def UpdateDrawing(self, dummyEvent=None):
deviceContext = wx.BufferedDC(wx.ClientDC(self), self.dcBuffer)
self.Draw(deviceContext)
示例5: SetDrawing
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedDC [as 别名]
def SetDrawing(self, drawFunc, args):
self.drawing = drawFunc
d = GetMonitorDimensions()[self.displayNum]
self.SetDimensions(d.x, d.y, d.width, d.height)
self._buffer = wx.EmptyBitmap(d.width, d.height)
dc = wx.BufferedDC(wx.ClientDC(self), self._buffer)
self.drawing(dc, *args)
#self.Refresh(eraseBackground=False)
wx.Frame.Show(self, True)
BringHwndToFront(self.GetHandle(), False)
self.SetCursor(wx.StockCursor(wx.CURSOR_BLANK))
示例6: RefreshView
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedDC [as 别名]
def RefreshView(self):
width, height = self.MessagePanel.GetClientSize()
bitmap = wx.EmptyBitmap(width, height)
dc = wx.BufferedDC(wx.ClientDC(self.MessagePanel), bitmap)
dc.Clear()
dc.BeginDrawing()
if self.CurrentMessage is not None:
dc.SetFont(self.Font)
for button in self.LeftButtons + self.RightButtons:
button.Draw(dc)
message_idx = self.CurrentMessage
message = self.LogMessages[message_idx]
draw_date = True
offset = 5
while offset < height and message is not None:
message.Draw(dc, offset, width, draw_date)
offset += message.GetHeight(draw_date)
previous_message, message_idx = self.GetPreviousMessage(message_idx)
if previous_message is not None:
draw_date = message.Date != previous_message.Date
message = previous_message
dc.EndDrawing()
self.MessageScrollBar.RefreshThumbPosition()
示例7: Update
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedDC [as 别名]
def Update(self):
"""Causes the canvas to be updated."""
dc = wx.BufferedDC(wx.ClientDC(self), self.buffer)
if WX3:
dc.BeginDrawing()
dc.Clear()
self.Draw(dc)
if WX3:
dc.EndDrawing()
示例8: DrawViewer
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BufferedDC [as 别名]
def DrawViewer(self):
"""
Redraw content displayed by Viewer
"""
# Create buffered DC for drawing in panel
width, height = self.GetSize()
bitmap = wx.EmptyBitmap(width, height)
dc = wx.BufferedDC(wx.ClientDC(self), bitmap)
dc.Clear()
# Get Graphics Context for DC, for anti-aliased and transparent
# rendering
gc = wx.GCDC(dc)
gc.BeginDrawing()
# Get first item
item = self.ItemsDict.values()[0]
# Get item variable path masked according Debug Variable Panel mask
item_path = item.GetVariable(
self.ParentWindow.GetVariableNameMask())
# Draw item variable path at Viewer left side
w, h = gc.GetTextExtent(item_path)
gc.DrawText(item_path, 20, (height - h) // 2)
# Update 'Release' button state and text color according to item forced
# flag value
item_forced = item.IsForced()
self.Buttons[1].Enable(item_forced)
self.RefreshButtonsPosition()
if item_forced:
gc.SetTextForeground(wx.BLUE)
# Draw item current value at right side of Viewer
item_value = item.GetValue()
w, h = gc.GetTextExtent(item_value)
gc.DrawText(item_value, width - 40 - w, (height - h) // 2)
# Draw other Viewer common elements
self.DrawCommonElements(gc)
gc.EndDrawing()