http://www.perlmonks.org?node_id=1018374


in reply to TK Toplevel Window List

ask the window manager, if it is possible, window manager will know (hint, it manages windows )

Tk::Wm

Replies are listed 'Best First'.
Re^2: TK Toplevel Window List (wm)
by Anonymous Monk on Feb 12, 2013 at 16:46 UTC
    Thank you, but which function would produce a window list? Or perhaps, there is a structure which should be examined?

      If you just wnat to get a list of all the toplevel windows from within a single process, it is pretty easy. Something like this perhaps.

      use warnings; use strict; use Tk; my $mw = MainWindow->new(-title => 'main window'); for (1..5) { $mw->Toplevel(-title => "toplevel #$_"); } for ($mw, $mw->children) { print $_->cget('-title'),"\n" if /Toplevel/ or /MainWindow/; } MainLoop;

      To find windows owned by other processes, you are going to need to interact with the OS window manager and that is going to be very specific to the your needs and the OS/WM you are using. There's no portable easy answer.

      Thank you, but which function would produce a window list?

      Perhaps one with "list" in the documentation, there aren't that many functions, you can find it, grep/ack makes it easier