Question

I'm using Tcl/Tk to build a UI and im running into the problem of trying to interact with a toplevel window before it's actually been created.

I created the toplevel window like this:

toplevel .t

Then i try and interact with it like this:

wm stackorder .t isabove .

But .t doesn't exist yet and i get an error about the window not being mapped. Effectively it equates to doing this:

winfo ismapped [toplevel .t]

which returns 0 but if i immediately run the following:

winfo ismapped .t

Then the return value is 1.

How can i know when a toplevel window is mapped (and therefore ready to interact with) so that i can proceed with my program?

Was it helpful?

Solution

I found the answer, i needed the following:

tkwait visibility .t
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top