![]() |
|
[Python] Need help using timers for circles - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Need help using timers for circles (/showthread.php?tid=6044201) |
Need help using timers for circles - Bora or Hyuna - Jan 26, 2020 Hi, I am having trouble trying to use the time_handler to basically spawn a ball every second. I have made a newBalls list where I will append each balls object into the list but the newBalls list is always empty and I have no idea why. Here is the code so for if anybody could explain to me how I would be able to spawn ball(circles) every second using the timer. Code import SimpleGUICS2Pygame.simpleguics2pygame as simpleguiRE: Need help using timers for circles - Riԁdle - Jan 26, 2020 Try doing Code def time_handler():and see if 1 is being printed RE: Need help using timers for circles - Bora or Hyuna - Jan 26, 2020 (Jan 26, 2020 09:36 AM)Riԁdle Wrote: Try doing I just tried this and 1 isn't being printed out either. I am clueless as to why... RE: Need help using timers for circles - Charger - Jan 26, 2020 (Jan 26, 2020 09:44 AM)Bora or Hyuna Wrote: I just tried this and 1 isn't being printed out either. I am clueless as to why... If it looks exactly like that your indentions are off and you’re probably running an older version of that script. Keep debugging by adding print before the line where that function is called. Keep going until it finally prints. RE: Need help using timers for circles - Bora or Hyuna - Jan 26, 2020 (Jan 26, 2020 09:46 AM)Charger Wrote: If it looks exactly like that your indentions are off and you’re probably running an older version of that script. Wow thanks so much! I hate these indentation issues I keep having with Python, I have finally managed to solve this! Thank you guys for the help, much appreciated. RE: Need help using timers for circles - Nomad.Null - Jan 26, 2020 I see that I'm late, but if it helps, I recommend using pycharm or atom.io text editor as your IDE for python. Auto indentation with tabs is much easier, and a good habit to get into for readability with all languages, not just python. On a side note, the indentation is the only complaint I ever hear from people who start learning python as their 2nd/3rd/+ language. It's a great language, but I guess that's one habit that's hard for programmers to form when coming from other languages. RE: Need help using timers for circles - Lindros - Jan 27, 2020 (Jan 26, 2020 10:15 PM)True Demon Wrote: I see that I'm late, but if it helps, I recommend using pycharm or atom.io text editor as your IDE for python. Auto indentation with tabs is much easier, and a good habit to get into for readability with all languages, not just python. I love Pycharm, it is so helpful in making development quicker and debugging easier. |