Learning Python - First Project

kyosohma at gmail.com kyosohma at gmail.com
Mon Apr 23 20:26:15 CEST 2007


On Apr 23, 9:52 am, KDawg44 <KDaw... at gmail.com> wrote:
> Hi,
>
> I am new to Python and am trying to write a little front end to
> another application in Python.
>
> What I want is to have a gui pop up listing some items with several
> buttons.  The guts of the program I am not having any trouble with but
> the GUI part I am (or more accurately, the transition between GUI
> pieces).
>
> The first GUI that pops up lists some groups in a listbox and gives
> the user the choice to create a new group, open a group, rename the
> group, or delete the group.  The new group and rename group buttons
> pop up a dialog gui asking for the name/new name.  The Open Group is
> to open another GUI listing projects within that group in a list with
> similar options (New Project, Open Project, Rename Project, Delete
> Project).
>
> My question is, how should I create all these GUIs?  Should each GUI
> be its own class with its own __init__?  Then is the first GUI the
> root (how I have it set up now) and all other GUIs using Toplevel()?
>
> I hope this makes sense (because it only sort of makes sense in my
> head).
>
> THanks for any suggestions.

Hi,

You should be able to create one main window as "root" and use
standard dialogs for the dialogs you mentioned. As for the "Open
Group" button, you might use a tree widget instead of opening another
window. You could put the tree in a splitter window or something and
it might look nicer. Of course, you can do another window, but it
would be a custom, hand-coded window and NOT a standard dialog. That
would mean that it would indeed be another class with its own
"__init__".

You can set both the standard dialogs and your custom one to
"ShowModal" and then you shouldn't need to use Toplevel().

I am assuming you are using Tkinter for your front-end GUI. You might
also take a gander at wxPython. It has an excellent demo you could
download and it might give you some additional ideas for
implementation: www.wxpython.org .

Mike




More information about the Python-list mailing list