Python Forum
While 2 mouse conditions - 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: While 2 mouse conditions (/thread-22662.html)



While 2 mouse conditions - tom1901 - Nov-21-2019

Hi guys!

Im trying to do the script do a sequence of acts while both left and right mouse buttons are pressed

while script2019 is True:
                count = 0
                while mouse.is_pressed(button='left')
Can you help me?


RE: While 2 mouse conditions - DreamingInsanity - Nov-21-2019

From the info given, it sounds like you want something like this:
while script2019 is True:
    count = 0
    while mouse.is_pressed(button='left') and mouse.is_pressed(button='right'):
        ###Do whatever



RE: While 2 mouse conditions - tom1901 - Nov-21-2019

(Nov-21-2019, 07:44 PM)DreamingInsanity Wrote: From the info given, it sounds like you want something like this:
while script2019 is True:
    count = 0
    while mouse.is_pressed(button='left') and mouse.is_pressed(button='right'):
        ###Do whatever

Sir, thank you for the answer.

I tried it before, but didnt work. Maybe because im trying it on a notebook touchpad buttons!?

Thanks anyway


RE: While 2 mouse conditions - DreamingInsanity - Nov-21-2019

(Nov-21-2019, 07:49 PM)tom1901 Wrote: Sir, thank you for the answer.

I tried it before, but didnt work. Maybe because im trying it on a notebook touchpad buttons!?

Thanks anyway

That shouldn't be a reason it wouldn't work.
Do you get any error when you try and run it?


RE: While 2 mouse conditions - tom1901 - Nov-21-2019

(Nov-21-2019, 07:53 PM)DreamingInsanity Wrote:
(Nov-21-2019, 07:49 PM)tom1901 Wrote: Sir, thank you for the answer.

I tried it before, but didnt work. Maybe because im trying it on a notebook touchpad buttons!?

Thanks anyway

That shouldn't be a reason it wouldn't work.
Do you get any error when you try and run it?

No errors, just no efects if i press both right and left buttons

EDIT:
just got
SyntaxError: multiple statements found while compiling a single statement


RE: While 2 mouse conditions - DreamingInsanity - Nov-21-2019

Quote: No errors, just no efects if i press both right and left buttons EDIT: just got SyntaxError: multiple statements found while compiling a single statement
Are you running this from the shell?


RE: While 2 mouse conditions - tom1901 - Nov-21-2019

(Nov-21-2019, 08:05 PM)DreamingInsanity Wrote:
Quote: No errors, just no efects if i press both right and left buttons EDIT: just got SyntaxError: multiple statements found while compiling a single statement
Are you running this from the shell?

was runing from cmd, but tried from the shell too and got the syntaxerror


EDIT:
I tried OR instead And just to test and it worked if press right or left

while mouse.is_pressed(button='left') OR mouse.is_pressed(button='right'):

EDIT 2

Sir, indeed the problem was it:

Quote:Maybe because im trying it on a notebook touchpad buttons!?

Just tried now NeatMouse a program that emulate mouse and it worked while both mouse buttons are pressed, so did not working before cause my notebook cant "click" right and left touchpad at same time. Thank you for the help!


RE: While 2 mouse conditions - DreamingInsanity - Nov-21-2019

(Nov-21-2019, 08:26 PM)tom1901 Wrote: Sir, indeed the problem was it:

Quote:Maybe because im trying it on a notebook touchpad buttons!?

Just tried now NeatMouse a program that emulate mouse and it worked while both mouse buttons are pressed, so did not working before cause my notebook cant "click" right and left touchpad at same time. Thank you for the help!
Interesting - Glad you found the issue though!