當前位置: 首頁>>代碼示例>>Python>>正文


Python wx.Timer方法代碼示例

本文整理匯總了Python中wx.Timer方法的典型用法代碼示例。如果您正苦於以下問題:Python wx.Timer方法的具體用法?Python wx.Timer怎麽用?Python wx.Timer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在wx的用法示例。


在下文中一共展示了wx.Timer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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() 
開發者ID:PacktPublishing,項目名稱:OpenCV-Computer-Vision-Projects-with-Python,代碼行數:26,代碼來源:chapter2.py

示例2: _init_base_layout

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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() 
開發者ID:PacktPublishing,項目名稱:OpenCV-Computer-Vision-Projects-with-Python,代碼行數:19,代碼來源:gui.py

示例3: loop_tk

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Timer [as 別名]
def loop_tk(kernel):
    """Start a kernel with the Tk event loop."""

    import Tkinter
    doi = kernel.do_one_iteration
    # Tk uses milliseconds
    poll_interval = int(1000*kernel._poll_interval)
    # For Tkinter, we create a Tk object and call its withdraw method.
    class Timer(object):
        def __init__(self, func):
            self.app = Tkinter.Tk()
            self.app.withdraw()
            self.func = func

        def on_timer(self):
            self.func()
            self.app.after(poll_interval, self.on_timer)

        def start(self):
            self.on_timer()  # Call it once to get things going.
            self.app.mainloop()

    kernel.timer = Timer(doi)
    kernel.timer.start() 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:26,代碼來源:eventloops.py

示例4: new_timer

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Timer [as 別名]
def new_timer(self, *args, **kwargs):
        """
        Creates a new backend-specific subclass of
        :class:`backend_bases.Timer`. This is useful for getting periodic
        events through the backend's native event loop. Implemented only
        for backends with GUIs.

        Other Parameters
        ----------------
        interval : scalar
            Timer interval in milliseconds
        callbacks : list
            Sequence of (func, args, kwargs) where ``func(*args, **kwargs)``
            will be executed by the timer every *interval*.

        """
        return TimerWx(*args, **kwargs) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:19,代碼來源:backend_wx.py

示例5: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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) 
開發者ID:ruanxiang,項目名稱:mr_saliency,代碼行數:20,代碼來源:live_demo.py

示例6: _init_base_layout

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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() 
開發者ID:mbeyeler,項目名稱:opencv-python-blueprints,代碼行數:18,代碼來源:gui.py

示例7: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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) 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:22,代碼來源:TreeCtrl.py

示例8: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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) 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:21,代碼來源:AnimatedWindow.py

示例9: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Timer [as 別名]
def __init__(self, size=(-1, -1), pic_path=None, display=0):
        wx.Frame.__init__(
            self,
            None,
            -1,
            "ShowPictureFrame",
            style=wx.NO_BORDER | wx.FRAME_NO_TASKBAR  #| wx.STAY_ON_TOP
        )
        self.SetBackgroundColour(wx.Colour(0, 0, 0))
        self.Bind(wx.EVT_LEFT_DCLICK, self.LeftDblClick)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        bitmap = wx.EmptyBitmap(1, 1)
        self.staticBitmap = wx.StaticBitmap(self, -1, bitmap)
        self.staticBitmap.Bind(wx.EVT_LEFT_DCLICK, self.LeftDblClick)
        self.staticBitmap.Bind(wx.EVT_MOTION, self.ShowCursor)
        self.timer = Timer(2.0, self.HideCursor) 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:18,代碼來源:__init__.py

示例10: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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) 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:26,代碼來源:TextViewer.py

示例11: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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) 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:26,代碼來源:DiscoveryPanel.py

示例12: new_timer

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Timer [as 別名]
def new_timer(self, *args, **kwargs):
        """
        Creates a new backend-specific subclass of
        :class:`backend_bases.Timer`. This is useful for getting periodic
        events through the backend's native event loop. Implemented only
        for backends with GUIs.

        Other Parameters
        ----------------
        interval : scalar
            Timer interval in milliseconds
        callbacks : list
            Sequence of (func, args, kwargs) where ``func(*args, **kwargs)``
            will be executed by the timer every *interval*.

        """
        return TimerWx(self, *args, **kwargs) 
開發者ID:alvarobartt,項目名稱:twitter-stock-recommendation,代碼行數:19,代碼來源:backend_wx.py

示例13: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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) 
開發者ID:Wyliodrin,項目名稱:pybass,代碼行數:10,代碼來源:wx_bass_control.py

示例14: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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) 
開發者ID:Wyliodrin,項目名稱:pybass,代碼行數:10,代碼來源:wx_ctrl_phoenix.py

示例15: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import 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) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:15,代碼來源:backend_wx.py


注:本文中的wx.Timer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。