Code Comments
Programming Forum and web based access to our favorite programming groups.Hi! having a widget path like .main.top.ok, how can a Tcl code find out what kind of widget it is? (i.e. button or label) Thanxalot! Shin - A.k.a. Thomas Braun
Post Follow-up to this messageShin The Gin wrote: > Hi! > having a widget path like .main.top.ok, how can a Tcl code find out what > kind of widget it is? (i.e. button or label) > > Thanxalot! > > Shin - A.k.a. Thomas Braun > [winfo class $widget]
Post Follow-up to this messageShin The Gin <N05PAM_shin@n05pam_shin.homelinux.net> wrote:
> Hi!
> having a widget path like .main.top.ok, how can a Tcl code find out what
> kind of widget it is? (i.e. button or label)
> Thanxalot!
winfo class $widget
would help for most standard widgets which have their class hardcoded.
Container widgets such as frame and toplevel allow to specify arbitrary
class, but it is easy to distinguish between three container classes -
frame, labelframe and toplevel:
if {[winfo toplevel $widget] eq "$widget"} {
puts "$widget is toplevel"
} elseif {![catch {$widget cget -labelanchor}]} {
# widget has -labelanchor option
puts "$widget is labelframe"
} else {
puts "$widget is ordinary frame
}
--
The only other people who might benefit from Linux8086 would be owners
of PDP/11's and other roomsized computers from the same era.
-- Alan Cox
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.