in reply to Re^2: Tk::MsgBox and my -message string
in thread Tk::MsgBox and my -message string

The Tk::MsgBox is intended to be a simplified widget that displays as soon as it is created.

So, your suspicion is correct. To fix it, move the creation of the MsgBox to the point where the value is available (inside "quiz_me"). You do not reference $front and $back elsewhere in any case.

You might want to consider making your interface a little nicer by using a Tk::DialogBox , when you get tired of annoying popup dialogs. The dialogBox could be pre-populated with the answer, which will have its VISIBLE property off. A button can then be pressed to REVEAL it. It would also help to have a NEXT button to step through the quiz. Essentially, your app becomes a single dialog box, which is a pretty standard way of implementing simple stuff.

     "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom

  • Comment on Re^3: Tk::MsgBox and my -message string

Replies are listed 'Best First'.
Re^4: Tk::MsgBox and my -message string
by davidov0009 (Scribe) on Jan 06, 2008 at 19:28 UTC

    I have been looking through Tk POD docs on CPAN have not read anything about a visible option or property for widgets, could you please provide a quick example of setting up visibility?

    I'm going to try setting up the dialog box in subroutine quiz_me, initialize the message with the answer and then have another sub called on the reveal answer key to configure visiblity for the message widget.


    use strict; use CGI;
      See the other answer in this thread, the one mentioning "withdraw".