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


Python Mouse类代码示例

本文整理汇总了Python中Mouse的典型用法代码示例。如果您正苦于以下问题:Python Mouse类的具体用法?Python Mouse怎么用?Python Mouse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: find_mining_icon

def find_mining_icon(offset=0,*args):
    """needs work, not fucntional, copy pasted from findBankIcon"""
    # bank hue range
    low = np.array([26,160,176])
    high = np.array([27,244,228])
    mask, mm_x, mm_y = get_mini_map_mask(low, high)

    #cv2.imshow('mask', mask)
    #cv2.waitKey(0)

    _, contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

    for c in contours:
        (x, y, w, h) = cv2.boundingRect(c)
        if args[0] == "n":
            x += mm_x
            y += mm_y - offset
            x2 = x + w
            y2 = y + (h/2) 
            Mouse.randMove(x,y,x2,y2,1)
            #Mouse.moveTo(x,y)
            RandTime.randTime(1,0,0,1,9,9)
            return

        x += mm_x
        y += mm_y
        x2 = x + w
        y2 = y + h
        Mouse.randMove(x,y,x2,y2,1)
        RandTime.randTime(1,0,0,1,9,9)
        return
开发者ID:jjvilm,项目名称:osrmacro,代码行数:31,代码来源:Minimap.py

示例2: run

def run():
	print '--> mission Dawning The Slavers (2 of 2)'

	if not ship.enableDefense():
		return False

	result = None
	begin = time.time()
	while not result and time.time() - begin < 5:
		time.sleep(0.5)
		result = findAtFull('close')
	if result:
		mouse.leftClickAtP(result)

	if not drones.launchSmall():
		return False

	overview.seekAndDestory()

	if not drones.back():
		return False	

	if not overview.activateAccelerationGate():
		return False

	if not drones.launchSmall():
		return False

	overview.seekAndDestory()

	if not drones.back():
		return False	

	print '<-- mission Dawning The Slavers (2 of 2)\n'
	return True
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:35,代码来源:DowningTheSlavers2.py

示例3: findBankIcon

def findBankIcon(offset=0, *args):
    # bank hue range
    low = np.array([21,157,173])
    high = np.array([25,178,221])
    mask, mm_x, mm_y = get_mini_map_mask(low, high)

    #cv2.imshow('mask', mask)
    #cv2.waitKey(0)

    _, contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

    for c in contours:
        (x, y, w, h) = cv2.boundingRect(c)
        try:
            if args[0] == "n":
                x += mm_x
                y += mm_y - offset
                x2 = x + w
                y2 = y + (h/2) 
                Mouse.randMove(x,y,x2,y2,1)
                #Mouse.moveTo(x,y)
                RandTime.randTime(1,0,0,1,9,9)
                return
        except:
            pass

        x += mm_x
        y += mm_y
        x2 = x + w
        y2 = y + h
        Mouse.randMove(x,y,x2,y2,1)
        RandTime.randTime(1,0,0,1,9,9)
        return
开发者ID:jjvilm,项目名称:osrmacro,代码行数:33,代码来源:Minimap.py

示例4: update

 def update(self, *args):
     layers = GetGame().get_layers()
     def sort_sprites_cmp(x, y):
         # Sorts sprites by layer from top down
         return layers.index(y.layer) - layers.index(x.layer)
     
     self._sprites.sort(sort_sprites_cmp)
     
     # Let's handle mouse clicks first
     for event in Mouse.get_events():
         if event.type == pygame.MOUSEMOTION:
             # We don't really care about these, we'll poll the
             # mouse directly later
             continue
         for sprite in self._sprites:
             if not isinstance(sprite, MouseClickSprite):
                 continue
             if sprite.is_clicked(event):
                 sprite.clicked(event)
                 if sprite.click_overlay is not True:
                     break
                     
     # Now let's handle mouseover.
     mouse_pos = Mouse.get_pos()
     mouse_now_over = []
     for sprite in self._sprites:
         if not isinstance(sprite, MouseOverSprite):
             continue
         if sprite.is_mouse_over(mouse_pos):
             mouse_now_over.append(sprite)
             # first, is this one that the mouse was previously over
             if sprite in self._mouse_previously_over:
                 if sprite.hover_overlay:
                     continue
                 else:
                     break
             # Now that we know it's not, we tell it the mouse is on it
             sprite.mouse_on()
             if sprite.hover_overlay:
                 continue
             break
     
     for sprite in self._mouse_previously_over:
         if sprite in mouse_now_over:
             continue
         sprite.mouse_off()
     
     self._mouse_previously_over = mouse_now_over
     
     Group.update(self, *args)
开发者ID:markamber,项目名称:rockfordrobotics,代码行数:50,代码来源:Sprite.py

示例5: findFishingIcon

def findFishingIcon():
    #fish color
    low = np.array([93,119,84])
    high = np.array([121,255,255])
    mask, mm_x, mm_y = get_mini_map_mask(low, high)

    _, contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    for c in contours:
        (x, y, w, h) = cv2.boundingRect(c)
        x += mm_x
        y += mm_y
        x2 = x + w
        y2 = y + h
        Mouse.randMove(x,y,x2,y2,1)
        run= 0
        RandTime.randTime(1,0,0,1,9,9)
        return 0
    return 1
开发者ID:jjvilm,项目名称:osrmacro,代码行数:18,代码来源:Minimap.py

示例6: run

def run():
	print '--> mission What Comes Around Goes Around'

	if not ship.enableDefense():
		return False

	if not drones.launchSmall():
		return False

	result = None
	begin = time.time()
	while not result and time.time() - begin < 5:
		time.sleep(0.2)
		result = findAtFull('close')
	if result:
		mouse.leftClickAtP(result)

	if not general.openMissionDetails():
		return False

	if not general.missionObjectiveComplete():
		return False

	if not drones.back():
		return False

	print '<-- mission What Comes Around Goes Around\n'
	return True
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:28,代码来源:WhatComesAroundGoesAround.py

示例7: run

def run():
    print "--> mission Intercept the Pirate Smugglers"

    result = None
    begin = time.time()
    while not result and time.time() - begin < 5:
        time.sleep(0.2)
        result = findAtFull("close")
    if result:
        mouse.leftClickAtP(result)

    if not ship.enableDefense():
        return False

    if not drones.launchSmall():
        return False

    if not general.openMissionDetails():
        return False

    ship.enableAfterburn()

    overview.seekAndDestory()

    if not general.missionObjectiveComplete():
        return False

    if not drones.back():
        return False

    print "<-- mission Intercept the Pirate Smugglers\n"
    return True
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:32,代码来源:InterceptThePirateSmugglers.py

示例8: enterStarMap

def enterStarMap():
	print '--> enter star map'
	key.pressEx(sc.Map)
	begin = time.time()
	while findAtProgressBar('initializing_map') or time.time() - begin < 3:
		time.sleep(0.5)
	mouse.moveToP(panel.center(panel.Full))
	mouse.wheel(100)
	print '<-- enter star map\n'
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:9,代码来源:General.py

示例9: run

def run():
	print '--> mission Eliminate the Pirate Campers'

	if not ship.enableDefense():
		return False

	if not drones.launchSentry():
		return False

	if not overview.switchTo('battle'):
		return False

	begin = time.time()
	result = None
	while not result and time.time() - begin < 5:
		result = findAtFull('close')
	if result:
		mouse.leftClickAtP(result)

	# kill small

	count = 0
	while count < 4:
		result = overview.lockTarget('s', 1)
		if result:
			count += 1

	begin = time.time()
	while time.time() - begin < 120:
		overview.lockTarget('s', 1)
		ship.fireOnce()
		drones.engage()

	if not drones.back():
		return False

	# seek and destory

	if not general.openMissionDetails():
		return False

	ship.enableAfterburn()

	if not drones.launchSmall():
		return False

	overview.seekAndDestory()

	if not general.missionObjectiveComplete():
		return False

	if not drones.back():
		return False

	print '<-- mission Eliminate the Pirate Campers\n'
	return True
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:56,代码来源:EliminateThePirateCampers.py

示例10: openInventory

def openInventory():
	print '--> open inventory'

	key.pressEx(sc.Inventory)
	mouse.moveToP(panel.center(panel.Inventory))
	while not findAtInventory('x'):
		time.sleep(0.2)

	print '<-- open inventory\n'
	return True
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:10,代码来源:Station.py

示例11: openMissionMenu

def openMissionMenu():
	print '--> open mission menu'

	result = findAtInfo('agent_mission')

	while not result:
		result = findAtInfo('agent_mission')
		time.sleep(1)
	mouse.leftClickAt(result[0] + 60, result[1] + 30)
	time.sleep(1)
	print '<-- open mission menu\n'
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:11,代码来源:General.py

示例12: handleDangerousAction

def handleDangerousAction():
	result = findAtFull('dangerous')
	if result:
		mouse.moveToP(result)
		result = None
		while not result:
			result = findAtFull('x')
		mouse.leftClickAtP(result)
		key.pressEx(sc.Unlock)
		return True
	else:
		return False
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:12,代码来源:Overview.py

示例13: lockEnemy

def lockEnemy(wait = 5):
	print '--> lock enemy'

	result = findEnemy()
	if not result:
		return False

	mouse.leftClickAtP(result)
	key.pressEx(sc.Lock)
	print 'wait for ' + str(wait) + ' seconds'
	time.sleep(wait)

	print '<-- lock enemy'
	return True
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:14,代码来源:Overview.py

示例14: switchTo

def switchTo(name):
	print '--> switch overview setting to ' + name

	trycount = 0
	success = False
	while not success and trycount < 3:
		success = True
		trycount += 1
		result = findAtOverview('overview')
		if not result:
			success = False
		mouse.leftClickAtP(result)
		mouse.moveTo(result[0] - 400, result[1])
		time.sleep(0.5)

		result = findAtOverview(name)
		if not result:
			success = False
		mouse.leftClickAtP(result)
		time.sleep(0.5)

		if not success:
			mouse.leftClickAtP(panel.center(panel.Full))

	if not success:
		return False

	print '<-- switch overview setting to ' + name + '\n'
	return True
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:29,代码来源:Overview.py

示例15: declineMission

def declineMission():
    print '--> decline mission'

    result = None
    while not result:
    	time.sleep(0.2)
    	result = findAtMissionRight('decline')
    mouse.leftClickAtP(result)

    begin = time.time()
    result = None
    while not result and time.time() - begin < 5:
    	time.sleep(0.5)
    	result = findAtFull('yes')
    if result:
    	mouse.leftClickAtP(result)

    print 'wait until decline'
    while not findAtMission('request_mission'):
        time.sleep(0.5)
    mouse.moveToP(panel.center(panel.MissionLeft))

    result = None
    while not result:
    	time.sleep(0.5)
    	result = findAtFull('x')
    mouse.leftClickAtP(result)
    time.sleep(1)

    print '<-- decline mission\n'
    return True
开发者ID:kidsang,项目名称:EVE-Script-2,代码行数:31,代码来源:Station.py


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