in reply to Re: Tk MainWindow and another TopLevel spawn order
in thread Tk MainWindow and another TopLevel spawn order

Many thanks pryrt for your investigation!

DoOneEvent behaves exactly in the way I want and I suspect that was the function Corion suspected to exists. It seems is not so good documented but I found some hints in the a ptkFAQ and a DoOneEvent POD on github.

I read on Mastering PerlTk:

It's actually rather difficult to find a use for DoOneEvent. [..] The DoOneEvent statement was an experiment in which we tried various e +vent masks, in an attempt to determine the optimal combination. You s +ee what we arrived at, which, interestingly, is exactly equivalent to +: $mw->update;

This is true indeed! using $mw->update; has the same effect of your DoOneEvent call.

Also ++pryrt to spot the mother of all my errors: $phwin = $mw->Toplevel(); must go after the $mw->update; or $mw->DoOneEvent() or just after the statement or in a sub called after (well is the same..).

I have no precise notions about the Tk loop works and i tend to use idioms that seem to work, of my own or borrowed.

Obviously master zentara was on our path before us dissecting how much DoOneEvent can be useful; see Re^2: Term::ReadLine and Tk

Thanks again!

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.