in reply to Non blocking a Dialog box in Perl Tk
Dialog (and the derived DialogBox) does a non configurable global grab in its Show method so no, other than sub-classing and using a substitute Show method, you can't make Dialog non-blocking.
However, it would be trivial to write your own version of a non-blocking "Dialog" pop up window. Something like this should give you a starting point.
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; $mw->update; my $number; notify( $mw, "Notification Window #" . ++$number, 4000 ); $mw->repeat( 5000, sub { notify( $mw, "Notification Window #" . ++$number, 4000 ) } ) +; MainLoop; sub notify { my ( $mw, $message, $ms ) = @_; my $notification = $mw->Toplevel(); $notification->transient($mw); $notification->overrideredirect(1); $notification->Popup( -popanchor => 'c' ); my $frame = $notification->Frame( -border => 5, -relief => 'groove +' )->pack; $frame->Label( -text => $message, )->pack( -padx => 5 ); $frame->Button( -text => 'OK', -command => sub { $notification->destroy; undef $notification +}, )->pack( -pady => 5 ); $notification->after( $ms, sub { $notification->destroy } ); }
|
|---|