[Tutor] mouse_buttons()
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Mon Dec 1 13:34:20 EST 2003
On Sun, 30 Nov 2003, Leung Cris wrote:
> How do I use that function? It's from Livewires . It returns three
> values, the middle , right, and left button. Depending on whether it is
> clicked, it will return a 0 or 1. But how do I get it so that when I
> click on the screen, it will stop? I've triedthis:
>
> while 1:
> mouse_buttons()
> if mouse_buttons() == 1
> break
>
>
> but... it doens't work
Hi Leung,
What does mouse_buttons() give back to us? Is it a number, or a list,
or...?
I see that you're trying to guess this by seeing if it's an integer. And
this is something that, with enough flailing, can be guessed with time.
But we can accelerate the process. *grin*
Take a closer look at:
http://www.livewires.org.uk/python/pdf/G-graphics.pdf
According to the documentation, mouse_buttons() is a function that returns
a dictionary. So you'll need to treat the return value of mouse_buttons()
as a dictionary with keys 'left', 'middle', and 'right'.
If you have more questions, please feel free to ask. Good luck to you!
More information about the Tutor
mailing list