Version 13 of toplevel

Updated 2003-03-20 18:17:33

http://purl.org/tcl/home/man/tcl8.4/TkCmd/toplevel.htm


DKF notes that, "toplevels on UNIX/X are really a collection of several windows; the window you draw on (which is what winfo id will tell you), another window for a menubar (if you've installed one) and a third one to contain the other two. If you do 'xwininfo -tree' you should be able to find out what's *really* going on."


Martin Lemburg: How can I detect if a widget is a toplevel? If I ask a widget for its class, this will fail e.g. at the root widget, because it doesn't return "Toplevel", but "Wish83". And toplevels could be given a class differing from "Toplevel" during their creation. So ... how can I detect a toplevel?


IDG [winfo toplevel .] returns . whereas

 [winfo toplevel .someothertoplevel] returns .someothertoplevel

MGS - In other words:

   proc istoplevel {W} {
     return [string equal [winfo toplevel $W] $W]
   }

Category Widget | Category Command | Tk syntax help | Arts and Crafts of Tcl-Tk Programming