If I understand you correctly, no, you can't easily change the default icon in the title bar of a messageBox. Mostly because the messageBox megawidget will auto display as soon as it is created, not allowing you any time to modify the window managers defaults.
You can however, use a Dialog (which messageBox is based on), since it is not automatically displayed as soon as it is created. It takes a little more work, but allows greater flexibility.
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Dialog; my $top = MainWindow->new; # a 32x32 gif image MIME64 encoded my $icon = $top->Photo(-format => 'gif', -data => ' R0lGODlhIAAgALMAACcREeOxI1lSTJ6XlW5padXNvLOspYF5cnFoV5KKfdnX1j44Ntq9Xv +v8+vjy wL65uiH5BAAAAAAALAAAAAAgACAAAwT/sMlJq7046837VsUjjkY5FkraPaUxigZBmLARav +CQlEM/ HIeeYWBIJISKi6KlOw5GB4JzaCTalM/iAUGw/ggCaeIwdg2VVHK1FwXLEGPjcIDWAoEyAv +eNuAeJ GQ89RwiFAgsCAgiJiYUHJUkZBS1ai4yFcEY7BR0gRQlgh41kT5EeFAQAqgIFKKcZqauvGw +eqAAKz DAwOFwK2BK8OAQEMF7G3F4KcFcLDvb8WCbZ0FQzEFg8LCwDaphIGtgkWRbwTCqAEeIkHFb +UGyQvl LF8+R4dEkX0YD2T8fXc+yICJougHAgwDRCFC1IWNjCjabvU5uE9TooHp3iTStsDIAW8UZg +ro2ILJ IyZFmBwZQWhkoko4ZAxtVATkwYUB6frokRIET5tQjRAYMKUAp4EohtLJERiF5KVFC6iBWU +BAgYyg OVNa0taI44IkAiDi5BqUqiI9jBZKo7rgXUKgjAYSPMQ1IiK62thFAAA7 '); # set up the dialog my $dialog = $top->Dialog( -bitmap => 'warning', -text => 'Danger Will Robinson!', -title => 'Robot Says', -buttons => [qw(Run! Flee! Panic!)], ); # Modify the default icon $dialog->Icon(-image => $icon); # display it my $answer = $dialog->Show; print $answer; MainLoop;
In reply to Re: Missing TK Messagebox icons
by thundergnat
in thread Missing TK Messagebox icons
by schimkat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |