I am currently on a project where I have to use Tkinter to make a game, and I would like to be able to move stuff on a canvas in Tkinter (like moving a circle with a ps4 controller's joystick for example). In this project, it is mandatory that I use tkinter to make the UI of the game, so I needed a python module to handle my PS4 controller. I chose to go for PyPS4Controller
But there are two event loops : tkinter.mainloop()
from the Tkinter module and controller.listen()
from the PyPS4Controller module.
I think I may be able to do something with python threads, since I could be listening to inputs inside threads, and then return a result after an input has been entered (button pressed..). But then I will not always be listening for inputs; it feels wrong to start and stop repetitively an event loop..
I'm really lost. Your help is much appreciated. Thanks ! ;D
Edit:
I don't need an answer that contains code, just the principle to apply to make them loop indefinitively and harmoniously is sufficient.
source https://stackoverflow.com/questions/70128259/how-to-make-2-event-loops-work-together-tkinter-and-pyps4controller
Comments
Post a Comment