I want to make a menu-driven program for elementary database management.
So, please provide me some idea on how to use alternative of gotoxy in python with the help of below example.
I have C code which draws a vertical & a horizontal line in the center of screen as below:
#include<stdio.h>
#define HLINE for(i=0;i<79;i++)
                  printf("%c",196);
#define VLINE(X,Y) {
                     gotoxy(X,Y);
                     printf("%c",196);
                   }
int main()
{
  int i,j;
  clrscr();
  gotoxy(1,12);
  HLINE
  for(y=1;y<25;y++)
      VLINE(39,y)
  return 0;
}
Is there something like gotoxy() in Python too?
Advertisement
Answer
First, there’s no such thing as gotoxy or clrscr in standard C. You’re using a platform-specific library which provides them. The solution is the same for Python: use a library. One library that supports a vast number of terminals and is part of the Python distribution is curses. See http://docs.python.org/2/library/curses.html for the documentation.