I reworked your original code in this fashion:
use strict;
use warnings;
use Tk;
use Tk::DialogBox;
my $mw = MainWindow->new;
my $dialog = $mw->DialogBox (
-title => "Please pick one of the three",
-buttons => ["One", "Two", "Three"]);
my $item = $dialog->Show();
print "Returned from the show, got $item\n";
This runs in the same fashion as your original code sans the one print statement. After scrutinizing the Tk and Tk::Dialog docs on CPAN, I believe I have the answer here.
From the docs for Tk::Dialog: "A Dialog object essentially consists of two subwidgets: a Label widget for the bitmap and a Label wigdet for the text of the dialog. If required, you can invoke the `configure' method to change any characteristic of these subwidgets."
You'll notice that the "silly box" that you refer to contains whatever you named this script in the title bar and the rest is blank. I believe that the "silly box" is in fact the Label widget for the bitmap. If so, then there is no way to not display that and display a dialog box using the Tk::Dialog module.
If someone shows that my surmise is incorrect, I'll be happy to retract this.
Update 5-05-06: Fixed a typo in the fifth line of code; I had "tmy" instead of "my".
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.