Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running in background #18

Open
kosirm opened this issue Dec 11, 2020 · 4 comments
Open

Running in background #18

kosirm opened this issue Dec 11, 2020 · 4 comments

Comments

@kosirm
Copy link

kosirm commented Dec 11, 2020

Hi, thank you for this app, it is extremely useful, I like it very much!
I would like to use it in "background" so I can create/use sounds(my piano) also when I'm typing in other windows (i.e. when pygame window is not focused...)
Do you have idea if this is possible maybe?
I'm really not much into python, that's why I ask. Thanks for any reply!
BR, Milan

@kosirm
Copy link
Author

kosirm commented Dec 11, 2020

Oh sorry... I just found line 328 in pianoputer_stereo.py # todo if the window lost focus cant hear the SOUND
So it's on your todo list already 👍 , hopefully you will implement solution soon. Thanks!

@kosirm
Copy link
Author

kosirm commented Dec 12, 2020

I've found WINDOWEVENT_FOCUS_LOST event attribute on pygame.display.set_mode but I have no idea how to use it or if it is usable at all...

@yoyoberenguer
Copy link
Contributor

Hi Kosirm,

Yes you could do a fix with WINDOWEVENT_FOCUS_LOST, therefore there is an easier way.
Use pygame.event.set_grab(True) just before the WHILE loop in the code.

The focus event allow pygame to control the keyboard and mouse directly, meaning that pygame will be the first to collect your keyboard/mouse inputs while the program is running

To switch between your windows, use ALT-TAB or exit pianocumputer.
Kind Regards

@kosirm
Copy link
Author

kosirm commented Dec 23, 2020

Thank you so much! I will do this now... BR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants