"Tony Cappellini" <[EMAIL PROTECTED]> wrote > I would like to find out how to structure the program so that when > the gui > version is finised, it will still be fully functional in cmd line > mode
For complex GUIs this can be quite difficult since GUIs are essentially stateless and command lines are usually stateful. But... > The gui itself will be very simple- A listbox, and button or two. For simple GUIs you are usually just collecting data and then executing one of several *transactions*. To do this via a command line is fairly simple. Just present a text menu of the possible transactions, then capture the data needed for the chosen transavction, then fire the transaction. The key thing is that the transaction code should be UI neutral, it should not have any form of input other than its parameters and it should retuirn its result as a string, or a tuple (or dictionary) of values that the UI can display. Combining GUI and Command versions in the same program just means reading the options at startup and calling the appropriate start UI function. Use modules to separate your concerns - one main, one for the GUI, one for the command line UI and one for the shared transactions. Import the shared module into both GUI modules and import both GUI modules into your main module. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor