[Tutor] Tutor Newbie

bhaaluu bhaaluu at gmail.com
Fri Jul 25 12:17:41 CEST 2008

On Thu, Jul 24, 2008 at 10:41 PM, Sam Last Name <the_sam_smart at yahoo.com> wrote:
> Hey guys, need some info on "programs" :)
> Heres a Very simple Script that works with basically any numbers.
> width = input("What is the Width?")
> length = input("What is the Length?")
> area = width*length
> print area
>  # my question is what would it take (programs, extra stuff in script,
> ect..) to make this a nice looking usable desktop program?

A usable desktop program probably implies a program that has a
Graphical User Interface (GUI) that can be invoked by clicking on an
Icon that resides on the Desktop. GUI programs might have drop
down menus which in turn might have sub-menus, dialogue boxes,
radio buttons, slider bars, and so forth. The GUI toolkit that usually
ships with Python is Tkinter. Other GUI toolkits that work with Python
include: wxPython, PyQT, PyGTK, PythonCard, AnyGui, and others.

I prefer CLI (Command Line Interface) programs myself, where options
are entered on the command line to do a job. Each program is small and
does one thing very well. Usually the output from one program can be
piped to another program, or input can be piped from another program,
to do the job. The program is usually started from an XTerm, Terminal,
or Konsole, or even from a non-GUI console. These programs usually
are small and fast. Your hands never have to leave the keyboard to
click a mouse button, or whatever.

Anyway, here is a simple Tkinter example from Programming Python 3rd Edition
(which has over 300 pages of Tkinter tutorial in it, plus several
full-feature GUI

import sys
from Tkinter import *
widget = Button(None, text='Hello widget world', command=sys.exit)
widget.pack( )
widget.mainloop( )

Key in the above code into your favorite text editor, save it as gui2.py,
then run it however you're running Python scripts
I do it like this:
python gui2.py

Happy Programming!
b h a a l u u at g m a i l dot c o m
Kid on Bus: What are you gonna do today, Napoleon?
Napoleon Dynamite: Whatever I feel like I wanna do. Gosh!

More information about the Tutor mailing list