[Tutor] Criticism / Suggestions

Alan Gauld alan.gauld at freenet.co.uk
Tue Mar 1 22:15:20 CET 2005


> programs that help me automate updating my website:
> - to invoke a players' ranking program,
> - to convert text files to php formats,
> - ...
> 
> I would like to go even further and employ Tkinter to:

If you want to put Tkinter on your web site then you probably will 
be dissapointed. If you want to use a Tkinter GUI to create 
HTML/PHP content then thats OK.

> - open and run a C and/or Python code (including arguments where 
> necessary),
> - name and safe generated html/php files.
> 
> The only thing I found is the following line of code:
> filemenu.add_command(label="Open...", command=askopenfile) 

If thats all you found you were probably looking in the wrong 
place. There is a Tkinter section on the Python website with 
links to Tkinter tutorials. Or you can try my ultra basic level 
intro to GUI programming with Tkinter.

I think you need a Frame containing an Entry widget for the 
command(or a drop down list or menu) and another Entry for the 
filename, which could be populated via the standard dialogs.
Finally you need a button to execute the command and that 
will call the commands module or os.popen or somesuch mechanism 
to do the work.

Have a look at the Tkinter tuitorials. If you don;t understand 
them try doing a command line version first, making sure to 
separate the function that does the work from the code that 
gets user input and displays output.

See how you get on...

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