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


Python wx.GetApp方法代碼示例

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


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

示例1: gui_repaint

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def gui_repaint(self, drawDC=None):
        """
        Performs update of the displayed image on the GUI canvas, using the
        supplied device context.  If drawDC is None, a ClientDC will be used to
        redraw the image.
        """
        DEBUG_MSG("gui_repaint()", 1, self)
        if self.IsShownOnScreen():
            if drawDC is None:
                drawDC=wx.ClientDC(self)

            drawDC.BeginDrawing()
            drawDC.DrawBitmap(self.bitmap, 0, 0)
            drawDC.EndDrawing()
            #wx.GetApp().Yield()
        else:
            pass 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:19,代碼來源:backend_wx.py

示例2: inputhook_wx1

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def inputhook_wx1():
    """Run the wx event loop by processing pending events only.

    This approach seems to work, but its performance is not great as it
    relies on having PyOS_InputHook called regularly.
    """
    try:
        app = wx.GetApp()
        if app is not None:
            assert wx.Thread_IsMain()

            # Make a temporary event loop and process system events until
            # there are no more waiting, then allow idle events (which
            # will also deal with pending or posted wx events.)
            evtloop = wx.EventLoop()
            ea = wx.EventLoopActivator(evtloop)
            while evtloop.Pending():
                evtloop.Dispatch()
            app.ProcessIdle()
            del ea
    except KeyboardInterrupt:
        pass
    return 0 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:25,代碼來源:inputhookwx.py

示例3: inputhook_wx2

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def inputhook_wx2():
    """Run the wx event loop, polling for stdin.

    This version runs the wx eventloop for an undetermined amount of time,
    during which it periodically checks to see if anything is ready on
    stdin.  If anything is ready on stdin, the event loop exits.

    The argument to elr.Run controls how often the event loop looks at stdin.
    This determines the responsiveness at the keyboard.  A setting of 1000
    enables a user to type at most 1 char per second.  I have found that a
    setting of 10 gives good keyboard response.  We can shorten it further,
    but eventually performance would suffer from calling select/kbhit too
    often.
    """
    try:
        app = wx.GetApp()
        if app is not None:
            assert wx.Thread_IsMain()
            elr = EventLoopRunner()
            # As this time is made shorter, keyboard response improves, but idle
            # CPU load goes up.  10 ms seems like a good compromise.
            elr.Run(time=10)  # CHANGE time here to control polling interval
    except KeyboardInterrupt:
        pass
    return 0 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:27,代碼來源:inputhookwx.py

示例4: inputhook_wx1

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def inputhook_wx1():
    """Run the wx event loop by processing pending events only.

    This approach seems to work, but its performance is not great as it
    relies on having PyOS_InputHook called regularly.
    """
    try:
        app = wx.GetApp()  # @UndefinedVariable
        if app is not None:
            assert wx.Thread_IsMain()  # @UndefinedVariable

            # Make a temporary event loop and process system events until
            # there are no more waiting, then allow idle events (which
            # will also deal with pending or posted wx events.)
            evtloop = wx.EventLoop()  # @UndefinedVariable
            ea = wx.EventLoopActivator(evtloop)  # @UndefinedVariable
            while evtloop.Pending():
                evtloop.Dispatch()
            app.ProcessIdle()
            del ea
    except KeyboardInterrupt:
        pass
    return 0 
開發者ID:fabioz,項目名稱:PyDev.Debugger,代碼行數:25,代碼來源:inputhookwx.py

示例5: inputhook_wx2

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def inputhook_wx2():
    """Run the wx event loop, polling for stdin.

    This version runs the wx eventloop for an undetermined amount of time,
    during which it periodically checks to see if anything is ready on
    stdin.  If anything is ready on stdin, the event loop exits.

    The argument to elr.Run controls how often the event loop looks at stdin.
    This determines the responsiveness at the keyboard.  A setting of 1000
    enables a user to type at most 1 char per second.  I have found that a
    setting of 10 gives good keyboard response.  We can shorten it further,
    but eventually performance would suffer from calling select/kbhit too
    often.
    """
    try:
        app = wx.GetApp()  # @UndefinedVariable
        if app is not None:
            assert wx.Thread_IsMain()  # @UndefinedVariable
            elr = EventLoopRunner()
            # As this time is made shorter, keyboard response improves, but idle
            # CPU load goes up.  10 ms seems like a good compromise.
            elr.Run(time=10)  # CHANGE time here to control polling interval
    except KeyboardInterrupt:
        pass
    return 0 
開發者ID:fabioz,項目名稱:PyDev.Debugger,代碼行數:27,代碼來源:inputhookwx.py

示例6: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def __init__(self, parent, wxid=wx.ID_ANY):
        images = {}
        tips = {}
        a = wx.GetApp()
        for k in self.states.keys():
            i = a.theme_library.get(('statuslight', self.states[k][0]))
            b = wx.BitmapFromImage(i)
            images[k] = b

        _StatusLight.__init__(self)
        wx.Panel.__init__(self, parent, id=wxid, style=wx.NO_BORDER)
        self.SetSize(wx.Size(24,24))
        self.bitmap = wx.StaticBitmap(self, wx.ID_ANY)

        self.images = images
        self.tips = tips

        self.Fit()

        self.change_state() 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:22,代碼來源:StatusLight.py

示例7: _checkInstance

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def _checkInstance(self):
        if self._instance is None:
            if wx.GetApp():
                self._instance = self._initfunc(*self._args, **self._kwargs) 
開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:6,代碼來源:core.py

示例8: Get

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def Get():
        """
        A staticmethod returning the currently active application object.  
        Essentially just a more pythonic version of :meth:`GetApp`.
        """
        return GetApp() 
開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:8,代碼來源:core.py

示例9: _Window_DestroyLater

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def _Window_DestroyLater(self):
    """
    Schedules the window to be destroyed in the near future.
    
    This should be used whenever Destroy could happen too soon, such
    as when there may still be events for this window or its children
    waiting in the event queue.
    """
    self.Hide()
    wx.GetApp().ScheduleForDestruction(self) 
開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:12,代碼來源:core.py

示例10: CallAfter

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def CallAfter(callableObj, *args, **kw):
    """
    Call the specified function after the current and pending event
    handlers have been completed.  This is also good for making GUI
    method calls from non-GUI threads.  Any extra positional or
    keyword args are passed on to the callable when it is called.
    
    :param PyObject callableObj: the callable object
    :param args: arguments to be passed to the callable object
    :param kw: keywords to be passed to the callable object
    
    .. seealso::
        :class:`CallLater`
    """
    assert callable(callableObj), "callableObj is not callable"
    app = wx.GetApp()
    assert app is not None, 'No wx.App created yet'
    
    if not hasattr(app, "_CallAfterId"):
        app._CallAfterId = wx.NewEventType()
        app.Connect(-1, -1, app._CallAfterId,
                    lambda event: event.callable(*event.args, **event.kw) )
    evt = wx.PyEvent()
    evt.SetEventType(app._CallAfterId)
    evt.callable = callableObj
    evt.args = args
    evt.kw = kw
    wx.PostEvent(app, evt) 
開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:30,代碼來源:core.py

示例11: _onDrawIdle

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def _onDrawIdle(self, *args, **kwargs):
        if wx.GetApp().Pending():
            self._idletimer.Restart(IDLE_DELAY, *args, **kwargs)
        else:
            del self._idletimer
            # GUI event or explicit draw call may already
            # have caused the draw to take place
            if not self._isDrawn:
                self.draw(*args, **kwargs) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:11,代碼來源:backend_wx.py

示例12: _create_wx_app

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def _create_wx_app():
    """
    Creates a wx.App instance if it has not been created sofar.
    """
    wxapp = wx.GetApp()
    if wxapp is None:
        wxapp = wx.App(False)
        wxapp.SetExitOnFrameDelete(True)
        # retain a reference to the app object so it does not get garbage
        # collected and cause segmentation faults
        _create_wx_app.theWxApp = wxapp 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:13,代碼來源:backend_wx.py

示例13: mainloop

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def mainloop(self):
        needmain = not wx.App.IsMainLoopRunning()
        if needmain:
            wxapp = wx.GetApp()
            if wxapp is not None:
                wxapp.MainLoop() 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:8,代碼來源:backend_wx.py

示例14: Destroy

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def Destroy(self, *args, **kwargs):
        try:
            self.canvas.mpl_disconnect(self.toolbar._idDrag)
            # Rationale for line above: see issue 2941338.
        except AttributeError:
            pass # classic toolbar lacks the attribute
        wx.Frame.Destroy(self, *args, **kwargs)
        if self.toolbar is not None:
            self.toolbar.Destroy()
        wxapp = wx.GetApp()
        if wxapp:
            wxapp.Yield()
        return True 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:15,代碼來源:backend_wx.py

示例15: get_app_wx

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import GetApp [as 別名]
def get_app_wx(*args, **kwargs):
    """Create a new wx app or return an exiting one."""
    import wx
    app = wx.GetApp()
    if app is None:
        if 'redirect' not in kwargs:
            kwargs['redirect'] = False
        app = wx.PySimpleApp(*args, **kwargs)
    return app 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:11,代碼來源:guisupport.py


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