Question: can I use this if the bulk of my application is non-Tk? In other words, say I'd like to present a dialog to the user when my app starts, but once they complete the dialog I'd like to go off and do something else that doesn't involve a GUI. I notice that both
Tk::Dialog and
Tk::DialogBox require a parent widget. Is there a way I could use one of these
as my main window, something like this:
my $dlg = Tk::DialogBox->new(-title => 'Login', -buttons => ['Ok', 'Ca
+ncel']); # this line doesn't work
$dlg->add('Label', -text => 'User name')->pack;
my $user_entry = $dlg->add('Entry')->pack;
$dlg->add('Label', -text => 'Password')->pack;
my $pwd_entry = $dlg->add('Entry', -show => '*')->pack;
my $btn = $dlg->Show;
my $username = $user_entry->get;
my $pwd = $pwd_entry->get;
if ($btn eq 'Ok') {
print "logging in with user $username and password $pwd\n";
}
and skip the MainLoop?
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.