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


Python pymouse.PyMouse方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: import pymouse [as 別名]
# 或者: from pymouse import PyMouse [as 別名]
def __init__(self, name):
        self.wname = name               #Name of the game window
        self.sv = ScreenViewer()        #For getting screens of the game
        self.mm = MovementMap()         #Bot's internal map of the world
        self.ts = TargetingSystem(m = 7, n = 9, ss = (800, 600), sb = (4, 0, 4, 12), cp = (400, 274), train = False)
        self.m = PyMouse()              #PyMouse object for triggering mouse input
        self.k = PyKeyboard()           #For triggering keyboard
        self.pm = ProjMap(800, 600)     #Convert between 3d and 2d coords
        self.p = None                   #The current path of the bot
        self.cpi = 0                    #Current potion index
        self.hp = None                  #Home position
        self.lwbp = False               #LW Button press occurred
        self.lwmoved = 0                #LW movement state
        self.state = Const.EVAD0        #State of bot
        self.tla = 0
        self.lwts = 0 
開發者ID:nicholastoddsmith,項目名稱:poeai,代碼行數:18,代碼來源:Bot.py

示例2: Play

# 需要導入模塊: import pymouse [as 別名]
# 或者: from pymouse import PyMouse [as 別名]
def Play():
    m = PyMouse()
    flag = ""
    loop = 0
    while loop < loops:
        # start = time.perf_counter()
        time.sleep(0.1)
        try:
            scr = get_screenshot()
            expr = recognize(scr)
            # 防止重複點擊
            if flag == expr:
                continue
            else:
                print("%-15s %-5s" % (expr, eval(expr)))
                flag = expr
                if eval(expr):
                    m.click(loc['click_true_x'], loc['click_true_y'], 1)
                else:
                    m.click(loc['click_false_x'], loc['click_false_y'], 1)
                loop += 1
        except:
            if 'scr' in vars():
                scr.save('failed.png')
            print("loops: %s" % loop)
            print('Error occurred: ')
            print(traceback.print_exc())
            sys.exit()
        # print('One loop: ', time.perf_counter() - a) 
開發者ID:voldikss,項目名稱:WechatGameAutoPlayer,代碼行數:31,代碼來源:autoplay.py

示例3: _get_mouse

# 需要導入模塊: import pymouse [as 別名]
# 或者: from pymouse import PyMouse [as 別名]
def _get_mouse():
        # noinspection PyPackageRequirements
        from pymouse import PyMouse
        return PyMouse() 
開發者ID:BlackLight,項目名稱:platypush,代碼行數:6,代碼來源:inputs.py

示例4: simulate_click_pc

# 需要導入模塊: import pymouse [as 別名]
# 或者: from pymouse import PyMouse [as 別名]
def simulate_click_pc():
    m = PyMouse()
    m.click(150, 650, 1) 
開發者ID:voldikss,項目名稱:WechatGameAutoPlayer,代碼行數:5,代碼來源:screenshots.py

示例5: __init__

# 需要導入模塊: import pymouse [as 別名]
# 或者: from pymouse import PyMouse [as 別名]
def __init__(self):
        super().__init__(capture=False)
        self._mouse = PyMouse()
        x, y = self._mouse.screen_size()
        self._x_center, self._y_center = x / 2.0, y / 2.0
        self._speed = 0
        self._turning = 0
        self._arm_joints = [0, 0, 0]
        self._gripper_open = True
        self._wheel_step = 0.5
        self._speed_decay = 0.9
        self._turning_decay = 0.6
        self.start() 
開發者ID:HorizonRobotics,項目名稱:SocialRobot,代碼行數:15,代碼來源:keybo_control.py

示例6: resize_state

# 需要導入模塊: import pymouse [as 別名]
# 或者: from pymouse import PyMouse [as 別名]
def resize_state(sm_model, sm_notebook_page, graphical_editor_controller):
    # Important: do not remove any information (including comments) of this function! Needed for debugging!
    import pymouse
    mouse = pymouse.PyMouse()
    from gaphas.item import Element, NW, NE, SE, SW

    from rafcon.gui.controllers.graphical_editor_gaphas import GraphicalEditorController
    assert isinstance(graphical_editor_controller, GraphicalEditorController)
    state_view_for_root_state = graphical_editor_controller.canvas.get_view_for_model(sm_model.root_state)
    from rafcon.gui.mygaphas.items.state import StateView
    assert isinstance(state_view_for_root_state, StateView)
    # print state_view_for_root_state
    # p = state_view_for_root_state.position
    # print state_view_for_root_state.position
    # print state_view_for_root_state.matrix
    # print state_view_for_root_state.handles()
    # print state_view_for_root_state.handles()[NW].pos.x
    # print state_view_for_root_state.handles()[NW].pos.y
    # print state_view_for_root_state.handles()[SE].pos.x
    # print state_view_for_root_state.handles()[SE].pos.y

    # self.view.get_matrix_i2v(self).transform_distance(width, height)
    from gaphas.view import View
    assert isinstance(state_view_for_root_state.view, View)

    v2i = state_view_for_root_state.view.get_matrix_v2i(state_view_for_root_state)
    i2v = state_view_for_root_state.view.get_matrix_i2v(state_view_for_root_state)
    c2i = state_view_for_root_state.canvas.get_matrix_c2i(state_view_for_root_state)
    i2c = state_view_for_root_state.canvas.get_matrix_i2c(state_view_for_root_state)

    # item_base_x, item_base_y = v2i.transform_point(p[0], p[1])
    # item_base_x, item_base_y = i2v.transform_point(p[0], p[1])
    #
    # item_base_x, item_base_y = i2c.tranform_point(v2i.transform_point(0, 0))
    # item_base_x, item_base_y = 0, 0

    se_x, se_y = i2v.transform_point(state_view_for_root_state.handles()[SE].pos.x.value,
                                     state_view_for_root_state.handles()[SE].pos.y.value)

    main_w = rafcon.gui.singleton.main_window_controller.view.get_top_widget()
    pos_main = main_w.get_position()
    rel_pos = sm_notebook_page.translate_coordinates(main_w, 0, 0)
    abs_pos_se = (pos_main[0] + rel_pos[0] + se_x, pos_main[1] + rel_pos[1] + se_y)

    mouse.move(*abs_pos_se)
    mouse.press(*abs_pos_se)
    mouse.release(abs_pos_se[0] + 20, abs_pos_se[1] + 20) 
開發者ID:DLR-RM,項目名稱:RAFCON,代碼行數:49,代碼來源:test_user_input_gaphas.py


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