Forum Archive

Open / close console

donnieh

If I have a UI up and running, how can I open or close the console programmatically?

For example, what if I wanted to display a plot, but then return back to the UI...

omz

You can use the console.hide_output() function for this.

donnieh

Since you cannot close the console output once opened, there is no point to to use it in a real app. I cannot get back to my UI from the console. This makes using modules like matplot that display in the console not helpful for a real app.

Is it true it is not useful for a real app?

omz

matplotlib doesn't have to output to the console, that's just one easy option... You could also save the output to a file and show it in an ImageView etc.

JonB

Another option would be to show the console, then use a popover view with a button that lets you return to your app...

donnieh

@omz, Thank you. that is good advice. By the way, some examples in the matplot documentation has interactive components like buttons that show up in the console when run. However, they do not work when run on Pythonista's console. Is this expected behavior?

@JonB, This is a good method, Thank you.