当前位置: 首页>>代码示例>>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;未经允许,请勿转载。