本文整理汇总了Python中wx.EVT_TIMER属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_TIMER属性的具体用法?Python wx.EVT_TIMER怎么用?Python wx.EVT_TIMER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_TIMER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def __init__(self, parent, id, title, capture, fps=15):
# initialize screen capture
self.capture = capture
# determine window size and init wx.Frame
frame,_ = freenect.sync_get_depth()
self.imgHeight,self.imgWidth = frame.shape[:2]
buffer = np.zeros((self.imgWidth,self.imgHeight,3),np.uint8)
self.bmp = wx.BitmapFromBuffer(self.imgWidth, self.imgHeight, buffer)
wx.Frame.__init__(self, parent, id, title, size=(self.imgWidth, self.imgHeight))
# set up periodic screen capture
self.timer = wx.Timer(self)
self.timer.Start(1000./fps)
self.Bind(wx.EVT_TIMER, self.NextFrame)
# counteract flicker
def disable_event(*pargs,**kwargs):
pass
self.Bind(wx.EVT_ERASE_BACKGROUND, disable_event)
# create the layout, which draws all buttons and
# connects events to class methods
self.CreateLayout()
示例2: _init_base_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def _init_base_layout(self):
"""Initialize parameters
This method performs initializations that are common to all GUIs,
such as the setting up of a timer.
It then calls an abstract method self.init_custom_layout() that
allows for additional, application-specific initializations.
"""
# set up periodic screen capture
self.timer = wx.Timer(self)
self.timer.Start(1000./self.fps)
self.Bind(wx.EVT_TIMER, self._on_next_frame)
self.Bind(wx.EVT_PAINT, self._on_paint)
# allow for custom modifications
self._init_custom_layout()
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def __init__(self, parent, capture, fps=24):
wx.Panel.__init__(self, parent)
self.capture = capture2
ret, frame = self.capture.read()
sal = mr_sal.saliency(frame)
sal = cv2.resize(sal,(320,240)).astype(sp.uint8)
sal = cv2.normalize(sal, None, 0, 255, cv2.NORM_MINMAX)
outsal = cv2.applyColorMap(sal,cv2.COLORMAP_HSV)
self.bmp = wx.BitmapFromBuffer(320,240, outsal.astype(sp.uint8))
self.timer = wx.Timer(self)
self.timer.Start(1000./fps)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_TIMER, self.NextFrame)
示例4: _init_base_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def _init_base_layout(self):
"""Initialize parameters
This method performs initializations that are common to all GUIs,
such as the setting up of a timer.
It then calls an abstract method self.init_custom_layout() that
allows for additional, application-specific initializations.
"""
# set up periodic screen capture
self.timer = wx.Timer(self)
self.timer.Start(1000. / self.fps)
self.Bind(wx.EVT_TIMER, self._on_next_frame)
# allow for custom modifications
self._init_custom_layout()
示例5: checkNode
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def checkNode():
dlm = nbdler.Manager()
if not os.path.exists('node.exe') or os.path.exists('node.exe.nbdler'):
dlg = wx.MessageDialog(None, u'该程序需要Nodejs.exe才能完成工作,是否要下载?', u'提示', wx.YES_NO | wx.ICON_INFORMATION)
if dlg.ShowModal() != wx.ID_YES:
return False
dl = nbdler.open(urls=[TOOL_REQ_URL['node']],
max_conn=16, filename='node.exe')
dlm.addHandler(dl)
dlg = gui.DialogGetTool(gui.frame_downloader, u'正在下载 Nodejs v10.15.3', dl.getFileSize(), dlm)
dlg.Bind(wx.EVT_TIMER, GetTool._process, dlg.timer)
dlg.timer.Start(50, oneShot=False)
dlm.run()
msg = dlg.ShowModal()
dlm.shutdown()
dlg.Destroy()
if msg == wx.ID_OK:
return True
else:
return False
else:
return True
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def __init__(self, treeCtrl):
wx.PyDropTarget.__init__(self)
self.treeCtrl = treeCtrl
self.srcNode = eg.EventItem
# specify the type of data we will accept
textData = wx.TextDataObject()
self.customData = wx.CustomDataObject(wx.CustomDataFormat("DragItem"))
self.customData.SetData("")
compositeData = wx.DataObjectComposite()
compositeData.Add(textData)
compositeData.Add(self.customData)
self.SetDataObject(compositeData)
self.lastHighlighted = None
self.isExternalDrag = True
self.whereToDrop = None
self.lastDropTime = clock()
self.lastTargetItemId = None
timerId = wx.NewId()
self.autoScrollTimer = wx.Timer(self.treeCtrl, timerId)
self.treeCtrl.Bind(wx.EVT_TIMER, self.OnDragTimerEvent, id=timerId)
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def __init__(self, parent):
wx.PyWindow.__init__(self, parent)
self.font = wx.Font(
40, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_BOLD
)
self.SetBackgroundColour((255, 255, 255))
self.logo1 = GetInternalBitmap("opensource-55x48")
self.logo2 = GetInternalBitmap("python-powered")
self.logo3 = GetInternalBitmap("logo2")
self.image = GetInternalImage("logo")
self.bmpWidth = self.image.GetWidth()
self.bmpHeight = self.image.GetHeight()
self.time = clock()
self.count = 0
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_TIMER, self.UpdateDrawing)
self.OnSize(None)
self.timer = wx.Timer(self)
self.timer.Start(10)
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def __init__(self, parent, tagname, window, controler, debug=False, instancepath=""):
if tagname != "" and controler is not None:
self.VARIABLE_PANEL_TYPE = controler.GetPouType(tagname.split("::")[1])
EditorPanel.__init__(self, parent, tagname, window, controler, debug)
self.Keywords = []
self.Variables = {}
self.Functions = {}
self.TypeNames = []
self.Jumps = []
self.EnumeratedValues = []
self.DisableEvents = True
self.TextSyntax = None
self.CurrentAction = None
self.InstancePath = instancepath
self.ContextStack = []
self.CallStack = []
self.ResetSearchResults()
self.RefreshHighlightsTimer = wx.Timer(self, -1)
self.Bind(wx.EVT_TIMER, self.OnRefreshHighlightsTimer, self.RefreshHighlightsTimer)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.parent = parent
self._init_list_ctrl()
listmix.ColumnSorterMixin.__init__(self, 4)
self._init_ctrls(parent)
self.itemDataMap = {}
self.nextItemId = 0
self.URI = None
self.Browser = None
self.ZeroConfInstance = None
self.RefreshList()
self.LatestSelection = None
self.IfacesMonitorState = None
self.IfacesMonitorTimer = wx.Timer(self)
self.IfacesMonitorTimer.Start(2000)
self.Bind(wx.EVT_TIMER, self.IfacesMonitor, self.IfacesMonitorTimer)
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def __init__(self, *args, **kwargs):
wx.Slider.__init__(self, *args, **kwargs)
self.player_ctrl = args[0]
self.Bind(wx.EVT_LEFT_DOWN, self.event_left_down)
self.Bind(wx.EVT_LEFT_UP, self.event_left_up)
self.timer_interval = 500
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.event_timer)
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def __init__(self, *args, **kwargs):
self.timer_interval = 500
self.player_ctrl = args[0]
wx.Slider.__init__(self, *args, **kwargs)
self.timer = wx.Timer(self)
self.Bind(wx.EVT_LEFT_DOWN, self.event_left_down)
self.Bind(wx.EVT_LEFT_UP, self.event_left_up)
self.Bind(wx.EVT_TIMER, self.event_timer)
示例12: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def __init__(self, parent, *args, **kwargs):
TimerBase.__init__(self, *args, **kwargs)
# Create a new timer and connect the timer event to our handler.
# For WX, the events have to use a widget for binding.
self.parent = parent
self._timer = wx.Timer(self.parent, wx.NewId())
self.parent.Bind(wx.EVT_TIMER, self._on_timer, self._timer)
# Unbinding causes Wx to stop for some reason. Disabling for now.
# def __del__(self):
# TimerBase.__del__(self)
# self.parent.Bind(wx.EVT_TIMER, None, self._timer)
示例13: start_event_loop
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def start_event_loop(self, timeout=0):
"""
Start an event loop. This is used to start a blocking event
loop so that interactive functions, such as ginput and
waitforbuttonpress, can wait for events. This should not be
confused with the main GUI event loop, which is always running
and has nothing to do with this.
Call signature::
start_event_loop(self,timeout=0)
This call blocks until a callback function triggers
stop_event_loop() or *timeout* is reached. If *timeout* is
<=0, never timeout.
Raises RuntimeError if event loop is already running.
"""
if hasattr(self, '_event_loop'):
raise RuntimeError("Event loop already running")
id = wx.NewId()
timer = wx.Timer(self, id=id)
if timeout > 0:
timer.Start(timeout*1000, oneShot=True)
bind(self, wx.EVT_TIMER, self.stop_event_loop, id=id)
# Event loop handler for start/stop event loop
self._event_loop = wx.EventLoop()
self._event_loop.Run()
timer.Stop()
示例14: start_event_loop
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def start_event_loop(self, timeout=0):
# docstring inherited
if hasattr(self, '_event_loop'):
raise RuntimeError("Event loop already running")
timer = wx.Timer(self, id=wx.ID_ANY)
if timeout > 0:
timer.Start(timeout * 1000, oneShot=True)
self.Bind(wx.EVT_TIMER, self.stop_event_loop, id=timer.GetId())
# Event loop handler for start/stop event loop
self._event_loop = wx.GUIEventLoop()
self._event_loop.Run()
timer.Stop()
示例15: start_event_loop
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TIMER [as 别名]
def start_event_loop(self, timeout=0):
"""
Start an event loop. This is used to start a blocking event
loop so that interactive functions, such as ginput and
waitforbuttonpress, can wait for events. This should not be
confused with the main GUI event loop, which is always running
and has nothing to do with this.
This call blocks until a callback function triggers
stop_event_loop() or *timeout* is reached. If *timeout* is
<=0, never timeout.
Raises RuntimeError if event loop is already running.
"""
if hasattr(self, '_event_loop'):
raise RuntimeError("Event loop already running")
id = wx.NewId()
timer = wx.Timer(self, id=id)
if timeout > 0:
timer.Start(timeout * 1000, oneShot=True)
self.Bind(wx.EVT_TIMER, self.stop_event_loop, id=id)
# Event loop handler for start/stop event loop
self._event_loop = wx.GUIEventLoop()
self._event_loop.Run()
timer.Stop()