Re: Newby Q: Getting widgets to appear all at once.

slebetman@xxxxxxxxx wrote:
Kenny Tilton wrote:

I have a Common Lisp GUI framework that drives Tk across a pipe.

On my first go, the engine instantiated a tree of instances each of
which gets a corresponding Tk widget. The constructor for each instance
goes ahead and makes its Tk counterpart by sending the appropriate
widget command.

With a complex dialogue, I pretty much watched the dialogue grow in
front of my eyes, bit by bit. Great fun, but it might scare the users.

I looked around for some window manager mechanism to suppress updates
untila certain point but did not spot anything. What I settled on was to
iconify the window straightaway, deiconify when the window was fully
constructed. worked great.

(a) Is that how it is usually done? If so...

I usually use withdraw instead of iconify. If you iconify then
depending on your window manager, you'll either get an icon on the
desktop (windowmaker) or a button on the taskbar (kde & MS Windows). If
you withdraw then your app becomes 'invisible'.

OK, thx. I saw "withdraw" but was not sure.

(b) What do I do if, in response to user input, I want to show or hide
some new GUI elements. Can I avoid making the user watch each widget
appear/disappear one-by-one?

What I tend to do is to create all that in a frame in the background
packing/placing/gridding as appropriate and when done pack/place/grid
that frame. All the UI elements in the frame will appear
simultaneously. To hide you can do a pack forget/place forget/grid
forget on that frame:

# The frame containing GUI elements, don't pack yet:
frame .f

# GUI elements:
pack [label .f.lab -text "Simple test"]
pack [button .f.hide -text "Hide" -command {pack forget .f}]

# Button to show the hidden frame:
pack [button .show -text "Show" -command {pack .f}]

Thx, I had a feeling I could achieve Good Things with the right order of packing.

Can I just ask: are you also talking to Tk across a stream and this is the only way to go to avoid visible widget assembly steps? Another response had me thinking I might (emphasis on might) do better by writing all at once to the stream. Or is there no way to avoid Tk deciding to post an update?

Well, I can at least move packing to the end of the message stream to get a significant improvement. Thx.