C4-unclean.txt (7.2 KB)
I’ve coded a little game of connect 4 just to see if i could do it with my actual knowledge of python (i’m only halfway through the https://www.codecademy.com/learn/learn-python-3 course)
It seems to work okay but i can’t find a way to clear the terminal after each play
i’ve tried the code block :
and noone of those worked.
(I wanted it to clear just before the call of
board() in the
I run it with IDLE 3.7 (x64) if that change something (don’t understand much about ide and terminal currently)
This will not work in the IDLE. You can run your script in the system shell and the
clear command will work correctly.
Python IDLE is not a normal shell and it does not act like a normal shell So you are limited to what the IDLE developers have implemented. And from my quick research, it looks like this feature is not available currently, but its implementation was heavily discussed over the past ten years Here is an issue report -> https://bugs.python.org/issue6143.
You still have some options! You can change the execution environment to PowerShell or CMD. Or you can install the extension for the IDLE that is linked in the issue I mentioned earlier (the file named
ClearWindow.py). It was written almost ten years ago so I am not sure if it will work or if that is a good idea, but it is still an option, I think.
Thank you were right !
I’ve updated the code with the clearing blocks and runned by using double click instead of the IDLE and it worked as intended !
Thanks @factoradic !