Posted: Mon May 29, 2006 5:42 pm Post subject: Perl/Tk Blinking Window
A while back, Matt Austin and some other guys from this forum were making an MSN Messenger client using Perl/Tk... I don't know if they're still doing that or not, but this could be interesting nonetheless:
I've discovered a possible start to a solution for making PerlTk windows flash on the task bar (like IM windows do when you receive a message and the window isn't in focus).
I found that if you call deiconify on a non-minimized window, while it doesn't have focus (nor does any window related to it)... its taskbar entry will flash.
However, if another window related to it has the focus (i.e. another Tk window from the same Perl process, or the command-prompt window running the process)... then deiconify just brings the window to your focus.
Here's an example script to illustrate this:
Code:
#!/usr/bin/perl -w
use Tk;
my $main = MainWindow->new (
-title => '### MAIN WINDOW ###',
);
$main->geometry ('300x300');
The main window will count down from 10 and then deiconify child one, then in 5 second intervals from there it will deiconify the opposite child window. If you leave the focus on one of this script's Tk windows, the deiconify call brings the window in question to your focus. If you have another window active (i.e. Firefox or Notepad), then the deiconified window will blink on the task bar on Windows.
This might be a start in the right direction for how to make windows blink for a PerlTk IM client though. _________________ Current Site (2008) http://www.cuvou.com/
Joined: 19 Jul 2004 Posts: 556 Location: Los Angeles, CA votes: 1
Posted: Mon May 29, 2006 9:48 pm Post subject:
That's a really good find. I have seen a few apps that use this to not be annoy by taking focus.. but still get you attention. _________________ [ matt ]