in reply to Tkx combobox error on quit

I'm not using Tkx::MainLoop() because this is a conversion from a console app to a GUI app that does stuff in the background.My question is: What is the timer doing,

I don't have Tkx, and can't run your code, but you need to understand what an eventloop is. When you call MainLoop, you start the eventloop and the widgets work. What is probably happening is you are starting the after timer, then since you never start the MainLoop, there is no eventloop for it to run in.

I can't run your code, but you might try this, which is a manual MainLoop, at the end of your code, or put it in your while loop

while (1) { $mw->DoOneEvent( DONT_WAIT | ALL_EVENTS ); }

But if you are converting from a console app to a gui, and need to keep things going in the background, there are much better ways than what you are trying. Post exactly what type of console app it is, what is does, and what kind of a gui you need for it. Usually a piped open, fork, or threads will work fine.

But Perl will let you do things the hard way if you want. :-)


I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: Tkx combobox error on quit
by Anonymous Monk on Sep 22, 2008 at 20:21 UTC

    Yes, I know what an eventloop is, but I have background stuff going on in addition to making widgets work. Calling Tkx::update() was one way to keep widgets working in my manual MainLoop, and Tkx::i::DoOneEvent was another way. DoOneEvent is way too slow; it seems like it does ONE event each time it's called, and with the background stuff, the GUI is quite unresponsive.

    The main problem is that I am not starting the timer. Tkx or Tcl/Tk (since Tkx is supposed to be just a wrapper for this) is starting it when the dropdown opens, and fails to stop it if the dropdown is closed in a way other than by clicking the down arrow or clicking in the entry field directly beside the down arrow.

    I guess my question is how to stop that timer automatically. Or how to determine the timer number associated with that dropdown so I can manually cancel it with Tkx::after_cancel().

    Tkx::i::DoOneEvent( DONT_WAIT | ALL_EVENTS ); looks like it could do what I need, but unfortunately I have been unable to Google how to get it to recognize ( DONT_WAIT | ALL_EVENTS ), or what their Tkx equivalent is.