[Tutor] A few Questions
Alan Gauld
alan.gauld at blueyonder.co.uk
Sat Sep 4 12:13:17 CEST 2004
> 1.What command makes the python programme print out the file it is
in?
The sys.argv[0] value should be the name of the python script.
I don't think it provides the full path however.
And what happens if you use py2exe I have no idea.
> 2.I want the programme to understand and interprete the keyboard
> buttons.. For example when the user clicks "esc" the programme will
> shut down...
If it's a GUI program you have to catch the keyboard events. If its a
console program and you are using Windows then you must use the
msvcrt.getch() function.
There is some info on both methods in my event driven programming
topic in my tutorial.
Mouse clicks will only be available in a GUI program (unless you
resort to some very deep magic using ctypes...)
> 3.The last but not least ... when I am converting the python file
> to exe(with py2exe) I want to pack all files created(the exe file ,
> library.zip and others)into a one windows installer file...
Get any windows installer and it will do all of that. There are
several available,. I believe a few are freeware although I use
Installshield which I got bundled with Delphi.
HTH,
Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld/tutor2/
More information about the Tutor
mailing list