Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
While 2 mouse conditions
#1
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?
Reply
#2
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
Reply
#3
(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
Reply
#4
(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?
Reply
#5
(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
Reply
#6
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?
Reply
#7
(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!
Reply
#8
(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!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  mouse 0.7.0 - mouse polling hate 125-1000hz penahuse 1 2,536 Dec-06-2019, 09:51 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020