[Tutor] Pretty and invisible

dman dsh8290@rit.edu
Fri, 26 Oct 2001 16:39:01 -0400


On Fri, Oct 26, 2001 at 03:39:11PM -0700, kromag@nsacom.net wrote:
| I would like to do two things with the following script:
| 
| First, I believe it could be made much simpler and prettier: May I have 
| suggestions?
| 
| I found an example of a phone book script in "Learning Python" that is 
| similar, I will begin there, but I get easily lost in inheritance (judging 
| from my last post, I would get lost on the way to the bathroom....) :-)

For inheritance, remember the "is-a" relationship.  If I have :

class Vehicle : pass
class Car( Vehicle ) : pass

then a Car instance is-a Vehicle instance.  That is, a Car can do
everything a Vehicle can do, but maybe with some extra functionality
or in a particular way.

| Second, I would like to either not echo or obscure the password raw_input().

Perhaps you can read a character synchronously from the input, then
immediately write out a backspace character and an asterix.  I
remember a friend of mine trying to do that in a little java program
once, but having some difficulty do to timing and stuff.  

Another way would be to access the terminal directly (I think this is
what, ex, ssh does) but that limits portability.

Perhaps ncurses has "password input" functionality?

Many GUI toolkits have password entry boxes.

HTH,
-D