HP Forums
Problem clearing the console in Python - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Problem clearing the console in Python (/thread-19621.html)



Problem clearing the console in Python - Monqi - 03-06-2023 05:53 PM

Hi everyone, I recently bought an HP Prime and I was very excited about programming with Python, so I started a very basic program. The problem came when I wanted to clear the output of the monitor, and none of the solutions that I knew or found worked on the HP Prime.
I want to clear the monitor during the execution of the program, not manually using the clear button on the calculator. I tried sending escape sequences to clear the console, but it didn't work. Also, I can't use the 'os.system('cls')' module apparently because it's not in this version of MicroPython.
Does anyone have a solution for this? Any piece of code that can do the job?

Sorry about my English, it's not my native language :(


RE: Problem clearing the console in Python - toml_12953 - 03-07-2023 04:39 PM

(03-06-2023 05:53 PM)Monqi Wrote:  Hi everyone, I recently bought an HP Prime and I was very excited about programming with Python, so I started a very basic program. The problem came when I wanted to clear the output of the monitor, and none of the solutions that I knew or found worked on the HP Prime.
I want to clear the monitor during the execution of the program, not manually using the clear button on the calculator. I tried sending escape sequences to clear the console, but it didn't work. Also, I can't use the 'os.system('cls')' module apparently because it's not in this version of MicroPython.
Does anyone have a solution for this? Any piece of code that can do the job?

Sorry about my English, it's not my native language Sad

I use this:

Code:
fillrect(0,0,0,320,240,0,0)

You can change the color to any color you wish.


RE: Problem clearing the console in Python - Monqi - 03-08-2023 04:16 PM

(03-07-2023 04:39 PM)toml_12953 Wrote:  
(03-06-2023 05:53 PM)Monqi Wrote:  Hi everyone, I recently bought an HP Prime and I was very excited about programming with Python, so I started a very basic program. The problem came when I wanted to clear the output of the monitor, and none of the solutions that I knew or found worked on the HP Prime.
I want to clear the monitor during the execution of the program, not manually using the clear button on the calculator. I tried sending escape sequences to clear the console, but it didn't work. Also, I can't use the 'os.system('cls')' module apparently because it's not in this version of MicroPython.
Does anyone have a solution for this? Any piece of code that can do the job?

Sorry about my English, it's not my native language Sad

I use this:

Code:
fillrect(0,0,0,320,240,0,0)

You can change the color to any color you wish.

Wow that's exactly what I was looking for, thank you very much.
Do you know where I can find the syntax of the specific functions for this calculator? For example, if I look for the syntax of the fillrect() function that you mentioned on the internet, I can't find anything related to it. It's very difficult for me to know the possibilities of the calculator if I don't know the functions and their parameters Sad