当前位置: 首页>>代码示例>>Python>>正文


Python win32gui.PumpWaitingMessages方法代码示例

本文整理汇总了Python中win32gui.PumpWaitingMessages方法的典型用法代码示例。如果您正苦于以下问题:Python win32gui.PumpWaitingMessages方法的具体用法?Python win32gui.PumpWaitingMessages怎么用?Python win32gui.PumpWaitingMessages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在win32gui的用法示例。


在下文中一共展示了win32gui.PumpWaitingMessages方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestSetWorldTransform

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def TestSetWorldTransform():
    wc = win32gui.WNDCLASS()
    wc.lpszClassName = 'test_win32gui_1'
    wc.style =  win32con.CS_GLOBALCLASS|win32con.CS_VREDRAW | win32con.CS_HREDRAW
    wc.hbrBackground = win32con.COLOR_WINDOW+1
    wc.lpfnWndProc=wndproc_1
    class_atom=win32gui.RegisterClass(wc)       
    hwnd = win32gui.CreateWindow(wc.lpszClassName,
        'Spin the Lobster!',
        win32con.WS_CAPTION|win32con.WS_VISIBLE,
        100,100,900,900, 0, 0, 0, None)
    for x in xrange(500):
        win32gui.InvalidateRect(hwnd,None,True)
        win32gui.PumpWaitingMessages()
        time.sleep(0.01)
    win32gui.DestroyWindow(hwnd)
    win32gui.UnregisterClass(wc.lpszClassName, None) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:win32gui_demo.py

示例2: TestGradientFill

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def TestGradientFill():
    wc = win32gui.WNDCLASS()
    wc.lpszClassName = 'test_win32gui_2'
    wc.style =  win32con.CS_GLOBALCLASS|win32con.CS_VREDRAW | win32con.CS_HREDRAW
    wc.hbrBackground = win32con.COLOR_WINDOW+1
    wc.lpfnWndProc=wndproc_2
    class_atom=win32gui.RegisterClass(wc)       
    hwnd = win32gui.CreateWindowEx(0, class_atom,'Kaleidoscope',
        win32con.WS_CAPTION|win32con.WS_VISIBLE|win32con.WS_THICKFRAME|win32con.WS_SYSMENU,
        100,100,900,900, 0, 0, 0, None)
    s=win32gui.GetWindowLong(hwnd,win32con.GWL_EXSTYLE)
    win32gui.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, s|win32con.WS_EX_LAYERED)
    win32gui.SetLayeredWindowAttributes(hwnd, 0, 175, win32con.LWA_ALPHA)
    for x in xrange(30):
        win32gui.InvalidateRect(hwnd,None,True)
        win32gui.PumpWaitingMessages()
        time.sleep(0.3)
    win32gui.DestroyWindow(hwnd)
    win32gui.UnregisterClass(class_atom,None) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:21,代码来源:win32gui_demo.py

示例3: demo

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def demo (delay=1000, stop=10):
    g = glork(delay, stop)
    # Timers are message based - so we need
    # To run a message loop while waiting for our timers
    # to expire.
    start_time = time.time()
    while 1:
        # We can't simply give a timeout of 30 seconds, as
        # we may continouusly be recieving other input messages,
        # and therefore never expire.
        rc = win32event.MsgWaitForMultipleObjects(
                (g.event,), # list of objects
                0, # wait all
                500,  # timeout
                win32event.QS_ALLEVENTS, # type of input
                )
        if rc == win32event.WAIT_OBJECT_0:
            # Event signalled.
            break
        elif rc == win32event.WAIT_OBJECT_0+1:
            # Message waiting.
            if win32gui.PumpWaitingMessages():
                raise RuntimeError("We got an unexpected WM_QUIT message!")
        else:
            # This wait timed-out.
            if time.time()-start_time > 30:
                raise RuntimeError("We timed out waiting for the timers to expire!") 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:29,代码来源:timer_demo.py

示例4: DISABLED_test_natlink_timer_manager

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def DISABLED_test_natlink_timer_manager(self):
        return

        import dragonfly.engines.backend_natlink as backend
        print(backend.is_engine_available())
        engine = backend.get_engine()
        print(engine)
        engine.connect()
        try:
            print("starting timer...")
            def callback():
                engine._log.error("timer callback")
                print("timer callback")
            timer = engine.create_timer(callback, 1)
            print("timer:", timer)

            print("starting Luke...")
            import sys
            import time
            import win32gui
            timeout = time.time() + 3
            while time.time() < timeout:
                print("Luke")
                sys.stdout.flush()
                if win32gui.PumpWaitingMessages():
                    raise RuntimeError("We got an unexpected WM_QUIT message!")
                time.sleep(1)

        finally:
            engine.disconnect()

#        self.engine.natlink.setTimerCallback(callback, int(sec * 1000))


#--------------------------------------------------------------------------- 
开发者ID:dictation-toolbox,项目名称:dragonfly,代码行数:37,代码来源:test_engine_natlink_timer.py

示例5: DISABLED_test_natlink_timer

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def DISABLED_test_natlink_timer(self):
        return

        callback_occurred = False
        def callback():
            callback_occurred = True
        ticks = 200

        import time
        import natlink
        natlink.natConnect()
        try:
            natlink.setTimerCallback(callback, ticks)
#            time.sleep(1)
            import sys
            import time
            import win32gui
            timeout = time.time() + 3
            while time.time() < timeout:
                print("Luke")
                sys.stdout.flush()
                if win32gui.PumpWaitingMessages():
                    raise RuntimeError("We got an unexpected WM_QUIT message!")
                time.sleep(1)
            natlink.setTimerCallback(None, 0)
            print("callback occurred:", callback_occurred)
        finally:
            natlink.natDisconnect()


#--------------------------------------------------------------------------- 
开发者ID:dictation-toolbox,项目名称:dragonfly,代码行数:33,代码来源:test_engine_natlink_timer.py

示例6: DISABLED_test_natlink_timer_manager

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def DISABLED_test_natlink_timer_manager(self):
        return

        import dragonfly.engines.backend_natlink as backend
        print backend.is_engine_available()
        engine = backend.get_engine()
        print engine
        engine.connect()
        try:
            print "starting timer..."
            def callback():
                engine._log.error("timer callback")
                print "timer callback"
            timer = engine.create_timer(callback, 1)
            print "timer:", timer

            print "starting Luke..."
            import sys
            import time
            import win32gui
            timeout = time.time() + 3
            while time.time() < timeout:
                print "Luke"
                sys.stdout.flush()
                if win32gui.PumpWaitingMessages():
                    raise RuntimeError, "We got an unexpected WM_QUIT message!"
                time.sleep(1)

        finally:
            engine.disconnect()

#        self.engine.natlink.setTimerCallback(callback, int(sec * 1000))


#--------------------------------------------------------------------------- 
开发者ID:t4ngo,项目名称:dragonfly,代码行数:37,代码来源:test_engine_natlink_timer.py

示例7: DISABLED_test_natlink_timer

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def DISABLED_test_natlink_timer(self):
        return

        callback_occurred = False
        def callback():
            callback_occurred = True
        ticks = 200

        import time
        import natlink
        natlink.natConnect()
        try:
            natlink.setTimerCallback(callback, ticks)
#            time.sleep(1)
            import sys
            import time
            import win32gui
            timeout = time.time() + 3
            while time.time() < timeout:
                print "Luke"
                sys.stdout.flush()
                if win32gui.PumpWaitingMessages():
                    raise RuntimeError, "We got an unexpected WM_QUIT message!"
                time.sleep(1)
            natlink.setTimerCallback(None, 0)
            print "callback occurred:", callback_occurred
        finally:
            natlink.natDisconnect()


#--------------------------------------------------------------------------- 
开发者ID:t4ngo,项目名称:dragonfly,代码行数:33,代码来源:test_engine_natlink_timer.py

示例8: idle

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def idle(self):
        return not win32gui.PumpWaitingMessages() 
开发者ID:euske,项目名称:pyrexecd,代码行数:4,代码来源:__init__.py

示例9: doWaitForMultipleEvents

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def doWaitForMultipleEvents(self, timeout):
        log.msg(channel='system', event='iteration', reactor=self)
        if timeout is None:
            #timeout = INFINITE
            timeout = 100
        else:
            timeout = int(timeout * 1000)

        if not (self._events or self._writes):
            # sleep so we don't suck up CPU time
            time.sleep(timeout / 1000.0)
            return

        canDoMoreWrites = 0
        for fd in self._writes.keys():
            if log.callWithLogger(fd, self._runWrite, fd):
                canDoMoreWrites = 1

        if canDoMoreWrites:
            timeout = 0

        handles = self._events.keys() or [self.dummyEvent]
        val = MsgWaitForMultipleObjects(handles, 0, timeout, QS_ALLINPUT | QS_ALLEVENTS)
        if val == WAIT_TIMEOUT:
            return
        elif val == WAIT_OBJECT_0 + len(handles):
            exit = win32gui.PumpWaitingMessages()
            if exit:
                self.callLater(0, self.stop)
                return
        elif val >= WAIT_OBJECT_0 and val < WAIT_OBJECT_0 + len(handles):
            fd, action = self._events[handles[val - WAIT_OBJECT_0]]
            log.callWithLogger(fd, self._runAction, action, fd) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:35,代码来源:win32eventreactor.py

示例10: doWaitForMultipleEvents

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def doWaitForMultipleEvents(self, timeout,
                                reads=reads,
                                writes=writes):
        log.msg(channel='system', event='iteration', reactor=self)
        if timeout is None:
            #timeout = INFINITE
            timeout = 100
        else:
            timeout = int(timeout * 1000)

        if not (events or writes):
            # sleep so we don't suck up CPU time
            time.sleep(timeout / 1000.0)
            return

        canDoMoreWrites = 0
        for fd in writes.keys():
            if log.callWithLogger(fd, self._runWrite, fd):
                canDoMoreWrites = 1

        if canDoMoreWrites:
            timeout = 0

        handles = events.keys() or [self.dummyEvent]
        val = MsgWaitForMultipleObjects(handles, 0, timeout, QS_ALLINPUT | QS_ALLEVENTS)
        if val == WAIT_TIMEOUT:
            return
        elif val == WAIT_OBJECT_0 + len(handles):
            exit = win32gui.PumpWaitingMessages()
            if exit:
                self.callLater(0, self.stop)
                return
        elif val >= WAIT_OBJECT_0 and val < WAIT_OBJECT_0 + len(handles):
            fd, action = events[handles[val - WAIT_OBJECT_0]]
            log.callWithLogger(fd, self._runAction, action, fd) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:37,代码来源:win32eventreactor.py

示例11: run

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def run(self):
        while not win32gui.PumpWaitingMessages():
            self.shell.process_idle_tasks()
            time.sleep(0.1) 
开发者ID:eavatar,项目名称:eavatar-me,代码行数:6,代码来源:console.py

示例12: TestDeviceNotifications

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def TestDeviceNotifications(dir_names):
    wc = win32gui.WNDCLASS()
    wc.lpszClassName = 'test_devicenotify'
    wc.style =  win32con.CS_GLOBALCLASS|win32con.CS_VREDRAW | win32con.CS_HREDRAW
    wc.hbrBackground = win32con.COLOR_WINDOW+1
    wc.lpfnWndProc={win32con.WM_DEVICECHANGE:OnDeviceChange}
    class_atom=win32gui.RegisterClass(wc)
    hwnd = win32gui.CreateWindow(wc.lpszClassName,
        'Testing some devices',
        # no need for it to be visible.
        win32con.WS_CAPTION,
        100,100,900,900, 0, 0, 0, None)

    hdevs = []
    # Watch for all USB device notifications
    filter = win32gui_struct.PackDEV_BROADCAST_DEVICEINTERFACE(
                                        GUID_DEVINTERFACE_USB_DEVICE)
    hdev = win32gui.RegisterDeviceNotification(hwnd, filter,
                                               win32con.DEVICE_NOTIFY_WINDOW_HANDLE)
    hdevs.append(hdev)
    # and create handles for all specified directories
    for d in dir_names:
        hdir = win32file.CreateFile(d, 
                                    winnt.FILE_LIST_DIRECTORY, 
                                    winnt.FILE_SHARE_READ | winnt.FILE_SHARE_WRITE | winnt.FILE_SHARE_DELETE,
                                    None, # security attributes
                                    win32con.OPEN_EXISTING,
                                    win32con.FILE_FLAG_BACKUP_SEMANTICS | # required privileges: SE_BACKUP_NAME and SE_RESTORE_NAME.
                                    win32con.FILE_FLAG_OVERLAPPED,
                                    None)

        filter = win32gui_struct.PackDEV_BROADCAST_HANDLE(hdir)
        hdev = win32gui.RegisterDeviceNotification(hwnd, filter,
                                          win32con.DEVICE_NOTIFY_WINDOW_HANDLE)
        hdevs.append(hdev)

    # now start a message pump and wait for messages to be delivered.
    print "Watching", len(hdevs), "handles - press Ctrl+C to terminate, or"
    print "add and remove some USB devices..."
    if not dir_names:
        print "(Note you can also pass paths to watch on the command-line - eg,"
        print "pass the root of an inserted USB stick to see events specific to"
        print "that volume)"
    while 1:
        win32gui.PumpWaitingMessages()
        time.sleep(0.01)
    win32gui.DestroyWindow(hwnd)
    win32gui.UnregisterClass(wc.lpszClassName, None) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:50,代码来源:win32gui_devicenotify.py

示例13: icon_wndproc

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import PumpWaitingMessages [as 别名]
def icon_wndproc(hwnd, msg, wp, lp):
    """ Window proc for the tray icons """
    if lp==win32con.WM_LBUTTONDOWN:
        ## popup menu won't disappear if you don't do this
        win32gui.SetForegroundWindow(hwnd)

        curr_desktop=win32service.OpenInputDesktop(0,True,win32con.MAXIMUM_ALLOWED)
        curr_desktop_name=win32service.GetUserObjectInformation(curr_desktop,win32con.UOI_NAME)
        winsta=win32service.GetProcessWindowStation()
        desktops=winsta.EnumDesktops()
        m=win32gui.CreatePopupMenu()
        desktop_cnt=len(desktops)
        ## *don't* create an item 0
        for d in range(1, desktop_cnt+1):
            mf_flags=win32con.MF_STRING
             ## if you switch to winlogon yourself, there's nothing there and you're stuck
            if desktops[d-1].lower() in ('winlogon','disconnect'):
                mf_flags=mf_flags|win32con.MF_GRAYED|win32con.MF_DISABLED
            if desktops[d-1]==curr_desktop_name:
                mf_flags=mf_flags|win32con.MF_CHECKED
            win32gui.AppendMenu(m, mf_flags, d, desktops[d-1])
        win32gui.AppendMenu(m, win32con.MF_STRING, desktop_cnt+1, 'Create new ...')
        win32gui.AppendMenu(m, win32con.MF_STRING, desktop_cnt+2, 'Exit')
            
        x,y=win32gui.GetCursorPos()
        d=win32gui.TrackPopupMenu(m,win32con.TPM_LEFTBUTTON|win32con.TPM_RETURNCMD|win32con.TPM_NONOTIFY,
            x,y, 0, hwnd, None)
        win32gui.PumpWaitingMessages()
        win32gui.DestroyMenu(m)
        if d==desktop_cnt+1:      ## Create new
            get_new_desktop_name(hwnd)
        elif d==desktop_cnt+2:    ## Exit
            win32gui.PostQuitMessage(0)
            win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, window_info[hwnd])
            del window_info[hwnd]
            origin_desktop.SwitchDesktop()
        elif d>0:
            hdesk=win32service.OpenDesktop(desktops[d-1],0,0,win32con.MAXIMUM_ALLOWED)
            hdesk.SwitchDesktop()
        return 0
    else:
        return win32gui.DefWindowProc(hwnd, msg, wp, lp) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:44,代码来源:desktopmanager.py


注:本文中的win32gui.PumpWaitingMessages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。