Home > Archive > Tcl > October 2004 > What kind of widget is .main.top.ok?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
What kind of widget is .main.top.ok?
|
|
| Shin The Gin 2004-10-26, 3:59 pm |
| 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
| |
| Bryan Oakley 2004-10-26, 3:59 pm |
| Shin 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]
| |
| Victor Wagner 2004-10-26, 3:59 pm |
| Shin 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
|
|
|
|
|