Skip to content

Calling mouse.double_click inside callback of mouse.on_click leads to infinite recursion #12

@redstoneleo

Description

@redstoneleo

Calling mouse.double_click inside callback of mouse.on_click leads to infinite recursion, so better to distinguish between a mouse click and a double click

I don't know if this issue is related to this post

My test code as follows, be sure to save all your unsaved work and you can fore a stop to a running Python program before test the issue , or else the infinite recursion mouse clicks might cause some problems to your work!


import mouse
import time



def onMouseClicked():
     print('1 single click')
     mouse.double_click(button='left')  #
     print('2 double click')
    # time.sleep(1000)
#     mouse.click(button='left')  #
#     print('3 single click')
#     mouse.unhook_all()
#mouse.on_double_click(onMouseClicked)
mouse.on_click(onMouseClicked)
mouse.wait(button='right', target_types=('double', 'up'))  #

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions