Mouse lib keeps dropping same error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Mouse lib keeps dropping same error (/thread-33289.html) |
Mouse lib keeps dropping same error - MLGpotato - Apr-13-2021 Hi. I have lost all my hopes fixing this issiue. Can anyone help? import mouse from tkinter import * import time import os run = type(True) def noclick(): run = False exit() def clicker(): cap = float(e) while (run == True): mouse.click("left") time.sleep(cap) mouse.on_double_click(lambda: exec(clicker())) mouse.on_right_click(lambda: exec(noclick())) print("Literaly a clicker for POPCAT") print("Enter number (the less the faster it goes)") print("Right click on mouse to turn the script off") e = input("Time gaps between clicks: ") print("Double click to activate")
RE: Mouse lib keeps dropping same error - bowlofred - Apr-13-2021 Looks like it wants a function, not for you to call the function. So should probably be something like: mouse.on_double_click(clicker) mouse.on_right_click(noclick) RE: Mouse lib keeps dropping same error - MLGpotato - Apr-13-2021 (Apr-13-2021, 03:46 PM)bowlofred Wrote: Looks like it wants a function, not for you to call the function. So should probably be something like: Looks like it worked! But I got another problem. It does not do the noclick function anymore. RE: Mouse lib keeps dropping same error - bowlofred - Apr-14-2021 What is the behavior when you try? It looks like it should stop the program via the exit(). Does that not happen? Also, what is the purpose of this line? run = type(True)Setting a flag to True I could see, but what is the return value of type() for?
RE: Mouse lib keeps dropping same error - MLGpotato - Apr-14-2021 (Apr-14-2021, 12:06 AM)bowlofred Wrote: What is the behavior when you try? It looks like it should stop the program via the exit(). Does that not happen?It wont close the app. You can press it as long as you like. It even does not run the line. Is it a problem with mouse.on_right_click(noclick)? RE: Mouse lib keeps dropping same error - deanhystad - Apr-14-2021 More likely a problem with while/sleep blocking noclick from running. Does the program exit if you right click before double clicking? RE: Mouse lib keeps dropping same error - MLGpotato - Apr-14-2021 (Apr-14-2021, 12:08 PM)deanhystad Wrote: More likely a problem with while/sleep blocking noclick from running. Does the program exit if you right click before double clicking?Yes RE: Mouse lib keeps dropping same error - bowlofred - Apr-14-2021 I've never used that module before. I can get information from it (mouse.hook() and mouse.get_position() both report fine), but I can't seem to trigger callbacks on mouse.click() and similar. Not sure if there's a problem with the code, if the documentation is incomplete, or if I'm just doing something wrong. But it does seem a little touchy. |