| Deutsch English Français Italiano |
|
<CF2dndGVPsS1DxL7nZ2dnZfqn_adnZ2d@brightview.co.uk> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-3.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 11 Jul 2024 08:04:56 +0000
From: Mark Summerfield <mark@qtrac.eu>
Subject: Re: How to do callbacks to methods
Newsgroups: comp.lang.tcl
References: <CF2dndaVPsTAEBL7nZ2dnZfqn_YAAAAA@brightview.co.uk>
MIME-Version: 1.0
User-Agent: Pan/0.154 (Izium; 517acf4)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <CF2dndGVPsS1DxL7nZ2dnZfqn_adnZ2d@brightview.co.uk>
Date: Thu, 11 Jul 2024 08:04:56 +0000
Lines: 26
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-ZbXoaSkq708u9H4/5sxrCqdJiWYs/VUSLLemxJIoKj1I2zPPoR+otlQrUXNS8yvLYMIlUDBu2jauA5d!s0fVGI17NIsFyW+fq+cezQ6vj5CQHonzJfFqhArB14UmfKZxo8yCC6jZfQ4lYeFnhu7tj1OcZxX0!ObFE+jB0134bCe2qcZsErEnjVA==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
Sorry for the noise, I found the solution on the wiki:
#!/usr/bin/env wish9
proc ::oo::Helpers::callback {method args} {
list [uplevel 1 {namespace which my}] $method {*}$args
}
tk appname "Test App"
oo::class create App {
constructor {} {
wm withdraw .
wm title . [tk appname]
grid [ttk::button .quitButton -text Quit -underline 0 \
-command [callback on_quit]]
bind . <Escape> [callback on_quit]
bind . <Alt-q> [callback on_quit]
}
method on_quit {} {
destroy .
}
method show {} {
wm deiconify .
raise .
}
}
set application [App new]
$application show