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


Python win32api.Sleep方法代码示例

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


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

示例1: ThreadedDemo

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def ThreadedDemo():
	rect = win32ui.GetMainFrame().GetMDIClient().GetClientRect()
	rect = rect[0], int(rect[3]*3/4), int(rect[2]/4), rect[3]
	incr = rect[2]
	for i in range(4):
		if i==0:
			f = FontFrame()
			title = "Not threaded"
		else:
			f = ThreadedFontFrame()
			title = "Threaded GUI Demo"
		f.Create(title, rect)
		rect = rect[0] + incr, rect[1], rect[2]+incr, rect[3]
	# Givem a chance to start
	win32api.Sleep(100)
	win32ui.PumpWaitingMessages() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:18,代码来源:threadedgui.py

示例2: TestWord8

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def TestWord8(word):
    word.Visible = 1
    doc = word.Documents.Add()
    wrange = doc.Range()
    for i in range(10):
        wrange.InsertAfter("Hello from Python %d\n" % i)
    paras = doc.Paragraphs
    for i in range(len(paras)):
        p = paras[i]()
        p.Font.ColorIndex = i+1
        p.Font.Size = 12 + (4 * i)
    # XXX - note that
    # for para in paras:
    #       para().Font...
    # doesnt seem to work - no error, just doesnt work
    # Should check if it works for VB!
    doc.Close(SaveChanges = 0)
    word.Quit()
    win32api.Sleep(1000) # Wait for word to close, else we
    # may get OA error. 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:22,代码来源:testMSOffice.py

示例3: _scan_for_self

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def _scan_for_self(self):
        win32api.Sleep(2000) # sleep to give time for process to be seen in system table.
        basename = self.cmdline.split()[0]
        pids = win32process.EnumProcesses()
        if not pids:
            UserLog.warn("WindowsProcess", "no pids", pids)
        for pid in pids:
            try:
                handle = win32api.OpenProcess(
                    win32con.PROCESS_QUERY_INFORMATION | win32con.PROCESS_VM_READ,
                        pywintypes.FALSE, pid)
            except pywintypes.error, err:
                UserLog.warn("WindowsProcess", str(err))
                continue
            try:
                modlist = win32process.EnumProcessModules(handle)
            except pywintypes.error,err:
                UserLog.warn("WindowsProcess",str(err))
                continue 
开发者ID:kdart,项目名称:pycopia,代码行数:21,代码来源:WindowsServer.py

示例4: TestWord8

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def TestWord8(word):
    word.Visible = 1
    doc = word.Documents.Add()
    wrange = doc.Range()
    for i in range(10):
        wrange.InsertAfter("Hello from Python %d\n" % i)
    paras = doc.Paragraphs
    for i in range(len(paras)):
        paras[i]().Font.ColorIndex = i+1
        paras[i]().Font.Size = 12 + (4 * i)
    # XXX - note that
    # for para in paras:
    #       para().Font...
    # doesnt seem to work - no error, just doesnt work
    # Should check if it works for VB!
    doc.Close(SaveChanges = 0)
    word.Quit()
    win32api.Sleep(1000) # Wait for word to close, else we
    # may get OA error. 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:21,代码来源:testMSOffice.py

示例5: DoDemoWork

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def DoDemoWork():
	print "Doing the work..."
	print "About to connect"
	win32api.MessageBeep(win32con.MB_ICONASTERISK)
	win32api.Sleep(2000)
	print "Doing something else..."
	win32api.MessageBeep(win32con.MB_ICONEXCLAMATION)
	win32api.Sleep(2000)
	print "More work."
	win32api.MessageBeep(win32con.MB_ICONHAND)
	win32api.Sleep(2000)
	print "The last bit."
	win32api.MessageBeep(win32con.MB_OK)
	win32api.Sleep(2000) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:16,代码来源:basictimerapp.py

示例6: Test

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def Test():
	num=1
	while num<1000:
		print 'Hello there no ' + str(num)
		win32api.Sleep(50)
		num = num + 1 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:cmdserver.py

示例7: demo

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def demo():
	d = StatusProgressDialog("A Demo", "Doing something...")
	import win32api
	for i in range(100):
		if i == 50:
			d.SetText("Getting there...")
		if i==90:
			d.SetText("Nearly done...")
		win32api.Sleep(20)
		d.Tick()
	d.Close() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:status.py

示例8: thread_demo

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def thread_demo():
	d = ThreadedStatusProgressDialog("A threaded demo", "Doing something")
	import win32api
	for i in range(100):
		if i == 50:
			d.SetText("Getting there...")
		if i==90:
			d.SetText("Nearly done...")
		win32api.Sleep(20)
		d.Tick()
	d.Close() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:status.py

示例9: test

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def test():
	w = WindowOutput(queueing=flags.WQ_IDLE)
	w.write("First bit of text\n")
	import _thread
	for i in range(5):
		w.write("Hello from the main thread\n")
		_thread.start_new(thread_test, (w,))
	for i in range(2):
		w.write("Hello from the main thread\n")
		win32api.Sleep(50)
	return w 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:winout.py

示例10: kill

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def kill(self, gracePeriod=5000):
        """
        Kill process. Try for an orderly shutdown via WM_CLOSE.  If
        still running after gracePeriod (5 sec. default), terminate.
        """
        win32gui.EnumWindows(self.__close__, 0)
        if self.wait(gracePeriod) != win32event.WAIT_OBJECT_0:
            win32process.TerminateProcess(self.hProcess, 0)
            win32api.Sleep(100) # wait for resources to be released 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:winprocess.py

示例11: CallPipe

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def CallPipe(fn, args):
    ret = None
    retryCount = 0
    while retryCount < 8:   # Keep looping until user cancels.
        retryCount = retryCount + 1
        try:
            return fn(*args)
        except win32api.error, exc:
            if exc.winerror==winerror.ERROR_PIPE_BUSY:
                win32api.Sleep(5000)
                continue
            else:
                raise 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:pipeTestServiceClient.py

示例12: WaitForServiceStatus

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def WaitForServiceStatus(serviceName, status, waitSecs, machine=None):
    """Waits for the service to return the specified status.  You
    should have already requested the service to enter that state"""
    for i in range(waitSecs*4):
        now_status = QueryServiceStatus(serviceName, machine)[1]
        if now_status == status:
            break
        win32api.Sleep(250)
    else:
        raise pywintypes.error(winerror.ERROR_SERVICE_REQUEST_TIMEOUT, "QueryServiceStatus", win32api.FormatMessage(winerror.ERROR_SERVICE_REQUEST_TIMEOUT)[:-2]) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:win32serviceutil.py

示例13: TestAll

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def TestAll():
    try:
        try:
            iexplore = win32com.client.dynamic.Dispatch("InternetExplorer.Application")
            TestExplorer(iexplore)

            win32api.Sleep(1000)
            iexplore = None

            # Test IE events.
            TestExplorerEvents()
            # Give IE a chance to shutdown, else it can get upset on fast machines.
            time.sleep(2)

            # Note that the TextExplorerEvents will force makepy - hence
            # this gencache is really no longer needed.

            from win32com.client import gencache
            gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1)
            iexplore = win32com.client.Dispatch("InternetExplorer.Application")
            TestExplorer(iexplore)
        except pythoncom.com_error, exc:
            if exc.hresult!=winerror.RPC_E_DISCONNECTED: # user closed the app!
                raise
    finally:
        iexplore = None 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:28,代码来源:testExplorer.py

示例14: sleep

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def sleep(self, sec):
        win32api.Sleep(sec * 1000, True) 
开发者ID:scalyr,项目名称:scalyr-agent-2,代码行数:4,代码来源:platform_windows.py

示例15: _input_left_mouse

# 需要导入模块: import win32api [as 别名]
# 或者: from win32api import Sleep [as 别名]
def _input_left_mouse(self, x, y):
        left, top, right, bottom = self.rect
        width, height = right - left, bottom - top
        if x < 0 or x > width or y < 0 or y > height:
            return

        win32gui.SetForegroundWindow(self.hwnd)
        pos = win32gui.GetCursorPos()
        win32api.SetCursorPos((left+x, top+y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
        win32api.Sleep(100) #ms
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
        win32api.Sleep(100) #ms
        # win32api.SetCursorPos(pos) 
开发者ID:NetEaseGame,项目名称:ATX,代码行数:16,代码来源:windows.py


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