Sinisterly

Full Version: Pygame Mouse Events Trouble
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Code:
for event in pygame.event.get():
        if event.type == pygame.MOUSEBUTTONDOWN:
            mouse_pressed == 1
            if mouse_pressed == 1:
                stuff()
Issue is the script runs and ends, while I want to keep it open and wait for it to get a mouse click.
ty
http://bfy.tw/3FO5 might help you out
(12-12-2015, 04:33 AM)Sans Wrote: [ -> ]http://bfy.tw/3FO5 might help you out

u got me good!
actually made me virus total so I can see where it redirects ;(
Your name just screams spam and cancer. Really.... a user named "xxxxxxxxxxxxxxxxxxxxxxxxx"... and a thread named "L"...
I suggest you clean up, before @roger_smith cleans up

btw: before you go telling me about how I am not answering your question.... just don't.
(12-12-2015, 04:39 AM)m0dem Wrote: [ -> ]Your name just screams spam and cancer. Really.... a user named "xxxxxxxxxxxxxxxxxxxxxxxxx"... and a thread named "L"...
I suggest you clean up, before @roger_smith cleans up

Sorry for not having the most HQ title or my username not being up to your standards Mr. m0dem!
(12-12-2015, 04:41 AM)xxxxxxxxxxxxxxxxxxxxxxxxx Wrote: [ -> ]Sorry for not having the most HQ title or my username not being up to your standards Mr. m0dem!

The title isn't "not HQ", it isn't even a title!!! You can change it to be more like... a title... by editing you main post. (for example, Pygame Mouse Events Trouble)

btw: Do you still need help with your script?
(12-12-2015, 04:47 AM)m0dem Wrote: [ -> ]The title isn't "not HQ", it isn't even a title!!! You can change it to be more like... a title... by editing you main post. (for example, Pygame Mouse Events Trouble)

btw: Do you still need help with your script?

Sure send me your JID
also changed title.
All you need:
Code:
for event in pygame.event.get():
    if event.type == pygame.MOUSEBUTTONUP:
        # do stuff...
^^^ (inside your main loop) ^^^

The problem with your code is: on line 3 ( mouse_pressed == 1 ) ... you can't use the equal to ( == ) operator to assign variables, you can only use the assignment operator ( = ) (not to mention this variable and next if statement are completely unneeded.)
If it doesn't work, just say.

btw: Good job on changing the title! Smile
@xxxxxxxxxxxxxxxxxxxxxxxxx
I assumed you had initialized everything else (the screen) before the loop through events, right?
You have to initialize the window or it will not work.
I don't know if Pygame is what you are looking for if you just want to get key presses...
(12-12-2015, 07:51 PM)m0dem Wrote: [ -> ]@xxxxxxxxxxxxxxxxxxxxxxxxx
I assumed you had initialized everything else (the screen) before the loop through events, right?
You have to initialize the window or it will not work.
I don't know if Pygame is what you are looking for if you just want to get key presses...

No didn't notice I had to call screen only used pygameinit()
Any recommendations then?
Pages: 1 2