[Tutor] a little help

Alan G alan.gauld at freenet.co.uk
Wed Aug 17 23:08:28 CEST 2005


Hello again,

I'm sending this on to the tutor list because you'll get a much
wider set of responses and ideas there.

> i want to make a program that is actualy going to be used maybe a 
> ftp
> program or something. but i want to make a window come up before the 
> program
> that ask you for a username and password. then when you click ok it 
> would
> check to see if the username and password where on the list from 
> another
> file. (also if possible i want the password file encriped)

What you are asking for is standard login type behaviour.
If you were using the command line I'd recommend the getpass
module but that won't help much in a GUI.

You will need to create a Simple window, probably based on
Toplevel (since you use Tkinter) with labels and Entries as
you did in your previous program. The difference is that you want
to inhibit the display of the users entry on the password control.

This can be done by specifying the show parameter of the Entry

Entry(top,show='*')

will display a * for each character input.

As for the encryption mechanism there is a standard Python module
called crypt that can deal with this. Unfortunately this only works
on Unix so if you use Windows (which I think you do?) then you will
need to write your own encryption routine or find another
module that works on Windows systems - anyone?

Hopefully those hints will get you started. As before build it up
slowly, get the login fixed first then add the features of the
final program one by one.

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