[Tutor] Display question

Alan Gauld alan.gauld at blueyonder.co.uk
Sun Jun 6 18:33:43 EDT 2004


> Hi, I am relatively new to python and I have a question that I
couldn't get
> answered in the tutorials.
> Is there any way to display text in defined coords?
> Ex: displaytext(text,coordx,coordy):

Unfortunately displaying things is very dependant on what kind of
device
you are using, since Python runs on anything from a PalmPilot to a
Sun workstation with all manner of things in between it is virtually
impossible for Python to have a standard way of displaying text at
specific locations. That's the bad news.

The good news is that various ways around this are available.

1) Use HTML and display results in a web browser
2) Use the curses library if its available, it has a coordinate
virtual
   window system whereby you can position the cursor before writing.
   The downside is its a lot harder to use than 'print'!
3) Use a GUI Toolkit like Tkinter which has a Text widget within
   which you can control where text appears.
4) There is a kind of generic console module out there which is
   written, I think, by Fred Lundh. I can't recall if X,Y control
   is one of its features but it certainly can clear the scren etc.

Welcome to the world of cross platform computing! :-)

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list