Input at bottom row at python

Viewed 46

how to make an input appear at the bottom of the terminal/console?

with

import Console

a = Console.getconsole()
a.text(0,-1,'YOU CAN PRINT TEXT IN THE BOTTOM ROW OF CONSOLE')

you can print text in the bottom of the console, but you can't input. how can you make an input at the bottom of the console?

Click to see image

More detailed picture

Im getting answers that are not what im searching exactly for but i understand them. Other option for me it would be have 2 consoles and whain i imput something in console1 smething happens to console2.

2 Answers

The console (or terminal) in python works in a way that it goes to the next available line. However, you can use the get_terminal_size() method to do complete the task.

What one could do is add many blank lines like this:

import os

# Get the size of the terminal
size = os.get_terminal_size()

print('number of rows', size.lines)

a="\n"*(size.lines - 2)

name= input(a+'what is your name?')

print('hello', name)

which would look like this:

enter image description here

Functions or libraries are not available to fulfill the desired output then there is always a way to achieve the result by logic.

print('abc')
a="\n"*10

x= input(a+'Enter here :')

print(x)
Related