But also my question is: how can I force $mw->messageBox to display good old squarish buttons as all other Tk functions?

You can't, messageBox is a convenience function inside Tk.pm, so you have to write your own, kinda tricky

#!/usr/bin/perl -- use strict; use warnings; use Tk; use Tk::Dialog; my $mw = new MainWindow; $mw->geometry( "300x300" ); my $label = $mw -> Label(-text=>"Hello World") -> pack(); for my $relief ( qw/ raised sunken flat ridge solid groove / ){ my $button = $mw -> Button( -text => $relief, -command => sub { myMessageBox( -parent => $Tk::widget, -relief => $relief,, #~ $Tk::widget->messageBox( -message => "The $relief glossary has been merged", -icon=> 'info', ); }, -relief => $relief, -width => 10, )-> pack(); } #~ $mw->WidgetDump;use Tk::WidgetDump; $mw->MainLoop; sub myMessageBox { my (%args) = @_; require Tk::Dialog; my $parent = delete $args{'-parent'}; my $relief = delete $args{'-relief'}; my $args = \%args; $args->{-bitmap} = delete $args->{-icon} if defined $args->{-ic +on}; $args->{-text} = delete $args->{-message} if defined $args->{-me +ssage}; $args->{-type} = 'OK' unless defined $args->{-type}; my $type; if ( defined( $type = delete $args->{-type} ) ) { delete $args->{-type}; my @buttons = grep( $_, map( ucfirst($_), split( /(abort|retry|ignore|yes|no|cancel|ok)/, lc($ty +pe) ) ) ); $args->{-buttons} = [@buttons]; $args->{-default_button} = ucfirst( delete $args->{-default} ) if defined $args->{-default}; if ( not defined $args->{-default_button} and scalar(@buttons) + == 1 ) { $args->{-default_button} = $buttons[0]; } my $md = $parent->Dialog(%$args); for my $b ( grep { $_->isa('Tk::Button') } $md->Subwidget('bot +tom')->children ) { $b->configure( -relief => $relief, -overrelief => $relief +); } my $an = $md->Show; $md->destroy if Tk::Exists($md); return $an; } } __END__

In reply to Re^3: Tk Buttons look by Anonymous Monk
in thread Tk Buttons look by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.