Python Forum

Full Version: While 2 mouse conditions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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
(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
(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?
(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
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?
(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!
(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!