[Pythonmac-SIG] 'Dynamic' UI with Python?

Jack Jansen Jack.Jansen@cwi.nl
Tue, 15 Sep 1998 23:52:49 +0200


Recently, Wolfgang Keller <wolfgang@amadeus.m.eunet.de> said:
> Another typical dumb newbie question :-):

If this is a newbie question I guess I also count as a newbie:-)

> I need to create a dialog box with contents that can only be determined at
> run-time (from reading in a PPD file, like the print dialog box). Is
> Tkinter the only way to do this with Python on the Mac (i hope not)? Having
> 398 different DITL resources and chosing among them at run-time isn't an
> option in this special case.

The easiest way is to create a very full dialog (in the DITL resource) 
and hide the items that aren't appropriate.

If this is somehow inappropriate it should be possible to create the
dialog by hand, by adding the appropriate controls to a window (or an
empty dialog?). I've never tried this as such (i.e. treating the
result just as you would an ordinary dialog), if there is
functionality missing from Python I would definitely like to hear
this. There may also be refernce count problems: the current toolbox
modules "knows" that if you created the controls by hand Python has to
remove them when the refcount drops to zero, while controls in dialogs 
are magically cleaned up when the dialog disappears. Again, I would
like to hear of problems.

Adding controls to a window and handling them yourself is definitely
no problem.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@cwi.nl      | ++++ if you agree copy these lines to your sig ++++
http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm