Re: [Tutor] Looking for a few commands
Nice Find! On Sun, 2006-09-10 at 08:50 +0100, Alan Gauld wrote: Chris Hengge [EMAIL PROTECTED] wrote Simple command to clear console? (C++ was something like system.clr()) Some sort of cursor positioning? (C++ was something like gotoxy) While looking for something else I stumbled across this module in the Vaults of Parnassus: WConio http://newcenturycomputers.net/projects/wconio.html Its a port of the old Borland turboC conio library to Python and there is a version for Python versions up to 2.4. Only works for DOS windows so far as I can tell, but thats what we wanted... It includes amongst many others the functions: WConio.clrscr() clears the screen and homes the cursor. WConio.cputs(string) prints a string starting at the current cursor position. WConio.getch() retrieves a keystroke from the console WConio.gettext(left, top, right, bottom) copies characters and attributes from the screen coordinates given and returns them in a string buffer. Usually used with puttext() below. WConio.gotoxy(x, y) positions the cursor at the given coordinates. etc... HTH ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for a few commands
Replying to the List The trick is to know either that Fred works at Pythonware, or that his nickname is the effbot... :-) http://effbot.org/downloads/ Sorry, neither are intuitively obvious... but he has lots of goodies on his site, worth perusing the list. And Fred's code is usually of a very high standard - ie it just works! Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld - Original Message - From: Chris Hengge [EMAIL PROTECTED] To: Alan Gauld [EMAIL PROTECTED] Sent: Thursday, September 07, 2006 5:25 AM Subject: Re: Looking for a few commands Where is Fred's site? lol... I've been looking for it and not finding anything like this. Finally Fred Lundh has a console library that tries to pull all this together into a single platform independant module, but its not a standard library module(yet) and you have to download it from Fred's site. Frankly if I need to do detailed screen manipulation in Python I usually just bite the bullet and build a GUI - its easier. HTH, Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for a few commands
Thanks for the details, I see several code bits I'll have to play with. I got the screen clearing bit no problem, thanks for that one. I'm still not used to being able to just use c libraries. I don't actually have a need to draw the cursor all over the screen for any practical application either personal or work, but I've got a bit of a fascination with linux terminals being able to draw progress bars or busy animations and figured I'd have a little fun. :] I came across curses which looks to be included in activepython so that might be of some use for my linux programming. Thanks again. On Thu, 2006-09-07 at 08:44 +0100, Alan Gauld wrote: Replying to the List The trick is to know either that Fred works at Pythonware, or that his nickname is the effbot... :-) http://effbot.org/downloads/ Sorry, neither are intuitively obvious... but he has lots of goodies on his site, worth perusing the list. And Fred's code is usually of a very high standard - ie it just works! Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld - Original Message - From: Chris Hengge [EMAIL PROTECTED] To: Alan Gauld [EMAIL PROTECTED] Sent: Thursday, September 07, 2006 5:25 AM Subject: Re: Looking for a few commands Where is Fred's site? lol... I've been looking for it and not finding anything like this. Finally Fred Lundh has a console library that tries to pull all this together into a single platform independant module, but its not a standard library module(yet) and you have to download it from Fred's site. Frankly if I need to do detailed screen manipulation in Python I usually just bite the bullet and build a GUI - its easier. HTH, Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for a few commands
I got the screen clearing bit no problem, thanks for that one. I'm still not used to being able to just use c libraries. Even the C libraries are non standard - they aren't part of the ANSI C definition. Its just that C libraries for the PC know what the hardware will look like so they can provide screen manipulation routines. But that code will be completely non-portable to any other computing platform. And even between C vendors the screen calls can be completely different. For example my MIX compiler uses cls() to clear the screen, My Borland one uses ClrScr() and I think that Microsoft Visual C uses something else again. Similarly for positioning the cursor, MIX uses curscol(), cursrow() whereas the Borland one uses gotoXY() - I think, its been a while! a fascination with linux terminals being able to draw progress bars or busy animations and figured I'd have a little fun. :] I came across curses which looks to be included in activepython so that might be of some use for my linux programming. There is an old curses module for DOS somewhere but I never got it working and it didn't implement all the functions.. Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for a few commands
Chris Hengge wrote: Thanks for the details, I see several code bits I'll have to play with. I got the screen clearing bit no problem, thanks for that one. I'm still not used to being able to just use c libraries. The ctypes module lets you call functions in shared libraries. It is standard in Python 2.5 or available from http://starship.python.net/crew/theller/ctypes/ I don't actually have a need to draw the cursor all over the screen for any practical application either personal or work, but I've got a bit of a fascination with linux terminals being able to draw progress bars or busy animations and figured I'd have a little fun. :] I came across curses which looks to be included in activepython so that might be of some use for my linux programming. Here is a progress bar: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207 You also might look at urwid though it doesn't seem to run on Windows: http://excess.org/urwid/ Unfortunately I don't think there is a console library that works on both Windows and Linux. For portable (and more functional) UIs you are better off learning Tkinter or wxPython. Kent Thanks again. On Thu, 2006-09-07 at 08:44 +0100, Alan Gauld wrote: Replying to the List The trick is to know either that Fred works at Pythonware, or that his nickname is the effbot... :-) http://effbot.org/downloads/ Sorry, neither are intuitively obvious... but he has lots of goodies on his site, worth perusing the list. And Fred's code is usually of a very high standard - ie it just works! Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld - Original Message - From: Chris Hengge [EMAIL PROTECTED] To: Alan Gauld [EMAIL PROTECTED] Sent: Thursday, September 07, 2006 5:25 AM Subject: Re: Looking for a few commands Where is Fred's site? lol... I've been looking for it and not finding anything like this. Finally Fred Lundh has a console library that tries to pull all this together into a single platform independant module, but its not a standard library module(yet) and you have to download it from Fred's site. Frankly if I need to do detailed screen manipulation in Python I usually just bite the bullet and build a GUI - its easier. HTH, Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for a few commands
Chris Hengge wrote: Woohoo for my first post! Simple command to clear console? (C++ was something like system.clr()) Some sort of cursor positioning? (C++ was something like gotoxy) This is operating system dependent. Which OS you use? -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for a few commands
On Wed, 2006-09-06 at 16:30 -0700, Bob Gailer wrote: Chris Hengge wrote: Woohoo for my first post! Simple command to clear console? (C++ was something like system.clr()) Some sort of cursor positioning? (C++ was something like gotoxy) This is operating system dependent. Which OS you use? I hope I'm replying to this correctly. But I'm currently learning the language on XP, but I will eventually be writing applications for both linux and windows at home and at work. Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor