[Tutor] On top of my last message..

alan.gauld@bt.com alan.gauld@bt.com
Wed, 16 Feb 2000 17:48:30 -0000


> However, I still don't know how to make something print 
> without adding spaces between variables.  

Use format strings:

print "%d%d%s" % (12,24,"Here it is")

Should print;

1224Here it is

> Nor do I know how to clear a screen (I just printed a bunch 
> of lines in my first program!)

Umm, thats actually quite hard!
On a PC you can be sure of the display equipment and so its 
easy but when you go multi platform - like python you have 
to cope with lots of different way to clear the screen 
- what does that mean on a Mac or in BeOS exactly?!

Even in unix theres a plethora of terminal types and you 
would have to read the terminal database to identify the 
correct codes etc.

Unless your desparate I'd stick to writing lots of lines!

The other approach is move the code to a GUI framework 
like Tkinter. Its probably easier than trying to write 
platform independant terminal hanbdling IMHO!

> , nor do I know how to use the equivalent of the gotoxy

Again that's platform dependant. Indeed on some terminals 
the functionality just isn't there! Consider what X and Y mean
on different platforms - character positions(as in DOS) or 
pixels? If you are programming using Pythonwin on a PC under 
windows you can do GoToXY using the Windows API but it uses 
pixels within the current window...

Alan G.