I'm a bot developer but I'm new to Python. I've been reading for hours now, planning the design of a new bot.
I'd like your opinion on performance issues with running a GUI and a very fast core loop to keep a modest array of game entities updated.
The bot consists of a main array in an infinite loop which continually updates and also runs calculations. I know from my past bots that GUIs provide a problem with performance as they need to wait to detect events.
I've looked at the possibility of a second thread, but I read that tkinter doesn't like more than one thread.
I've checked out the idea of using .after to run the core array loop from the tkinter mainloop but my gut tells me that this would be bad practice.
Right now I feel all I can do is try to contain the GUI and the core array all in one loop but this has never been good for performance.
Are there better ways of designing the structure of this bot that I have not discovered?
Edit
I decided on removing the mainloop from tinker and simply using .update() to update any gui components I have, right now, this only consists of some labels which overlay the game screen.
Both the labels and the bot's functions run great so far.
Using tkinter and .after
, I wrote a little single-threaded program that displays 1000 ovals that move randomly across the screen, updating every 50ms, and I don't see any lag. At 10ms I think I maybe see a tiny bit of lag.
These are simple objects with very little math to calculate the new positions, and there's no collision detection except against the edges of the window.
The GUI seems responsive. I am able to type into a text window in the same GUI as fast as I can.
I don't know how that compares to what you want to do.