Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

It's documented in The Book, somewhere... -- Larry Wall in <10502@jpl-devvax.JPL.NASA.GOV>


devel / comp.lang.tcl / Re: A simple (?) Tk question

SubjectAuthor
* A simple (?) Tk questionHelmut Giese
+* Re: A simple (?) Tk questionRalf Fassel
|`* Re: A simple (?) Tk questionHelmut Giese
| `- Re: A simple (?) Tk questionRalf Fassel
+- Re: A simple (?) Tk questionGerald Lester
+* Re: A simple (?) Tk questionet99
|`- Re: A simple (?) Tk questionAndreas Leitgeb
+- Re: A simple (?) Tk questionEmiliano
`- Re: A simple (?) Tk questionHelmut Giese

1
A simple (?) Tk question

<dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13670&group=comp.lang.tcl#13670

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: A simple (?) Tk question
Date: Wed, 17 Apr 2024 16:21:02 +0200
Organization: ratiosoft
Lines: 48
Message-ID: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 17 Apr 2024 16:21:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="5a512506475f27b7c30f8226b62d92c3";
logging-data="1744957"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19kBzgwC8MEt6yDQSQLSpau"
Cancel-Lock: sha1:PxGQ36QyR3c4rECo45PEWFW0uPM=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
 by: Helmut Giese - Wed, 17 Apr 2024 14:21 UTC

Hello out there,
for a kinf´d of technical app I need a 'switch type' button - that is
a button stays pressed when pressed once and only gets released when
pressed again. (Whereas the normal GUI behaviour of buttons is more
the 'door bell' type).
I did come as far as keeping it pressed using the code below:
---
package require Tk
foreach ch [winfo children "."] {destroy $ch}

proc btnPress {w var} {
if {[set $var]} {
puts "calling 'tk::ButtonUp $w'"
tk::ButtonUp $w
set $var 0
} else {
puts "calling 'tk::ButtonDown $w'"
tk::ButtonDown $w
set $var 1
}
}

proc tst {} {
set btn [button .btn -width 3 -text ""]
pack $btn
set ::${btn}State 0
bind $btn <Button-1> [list btnPress %W ::${btn}State]
bind $btn <Enter> {break}
bind $btn <Leave> {break}
bind $btn <<Invoke>> {break}
bind $btn <Key-space> {break}
bind $btn <ButtonRelease-1> {break}
return $btn
}

set b [tst]
---
All the 'break' statements are for disabling the class bindings for
'Button'.
What I see is
- on the first press the ButtonDown message appears and the button
gets pressed
- on following presses I see the Up/Down messages appear as they
should - but my button never gets released again.
This is on Windows 10 and Tcl 8.6.10.

Any help will be greatly appreciated
Helmut

Re: A simple (?) Tk question

<yga1q74hxmc.fsf@panther.akutech-local.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13671&group=comp.lang.tcl#13671

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: A simple (?) Tk question
Date: Wed, 17 Apr 2024 16:28:27 +0200
Lines: 22
Message-ID: <yga1q74hxmc.fsf@panther.akutech-local.de>
References: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net ppHBdqTQUKHlP6owxvFhQQX38KJCKXc/vBnlcJX9v+O+u4CTc=
Cancel-Lock: sha1:OLeyw8o28mSqBkxFNRsteAmvcCc= sha1:84RoFwMpLdeB4scMpc24QBUUE7c= sha256:rv5kA3220+YLjcNlgKsLsAYJ7tKskrlMtbkAOESqdRo=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Wed, 17 Apr 2024 14:28 UTC

* Helmut Giese <hgiese@ratiosoft.com>
| Hello out there,
| for a kinf´d of technical app I need a 'switch type' button - that is
| a button stays pressed when pressed once and only gets released when
| pressed again. (Whereas the normal GUI behaviour of buttons is more
| the 'door bell' type).
--<snip-snip>--
| Any help will be greatly appreciated

Check the -indicatoron option for TCL *radiobuttons*.

Command-Line Name:-indicatoron
Database Name: indicatorOn
Database Class: IndicatorOn

Specifies whether or not the indicator should be drawn. Must be
a proper boolean value. If false, the -relief option is ignored
and the widget's relief is always sunken if the widget is se-
lected and raised otherwise.

HTH
R'

Re: A simple (?) Tk question

<t5622jhfmstlc2ba6s90am19nhrfuvhgmb@4ax.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13677&group=comp.lang.tcl#13677

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: Re: A simple (?) Tk question
Date: Thu, 18 Apr 2024 15:00:16 +0200
Organization: ratiosoft
Lines: 18
Message-ID: <t5622jhfmstlc2ba6s90am19nhrfuvhgmb@4ax.com>
References: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com> <yga1q74hxmc.fsf@panther.akutech-local.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 18 Apr 2024 15:00:16 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="03052c2180919de45abdab6803c1056a";
logging-data="2392589"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19I/z8pUr5XNa9nZznhY1zq"
Cancel-Lock: sha1:craMtpqzNnEZYGyDpP9NKoW1sKc=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
 by: Helmut Giese - Thu, 18 Apr 2024 13:00 UTC

Hello Ralf,
>
>Check the -indicatoron option for TCL *radiobuttons*.
>
> Command-Line Name:-indicatoron
> Database Name: indicatorOn
> Database Class: IndicatorOn
>
> Specifies whether or not the indicator should be drawn. Must be
> a proper boolean value. If false, the -relief option is ignored
> and the widget's relief is always sunken if the widget is se-
> lected and raised otherwise.
>
this is interesting. I will see, what it looks like.
Many thanks
Helmut
PS: But I still would like to know why that button doesn't go up again
....

Re: A simple (?) Tk question

<8W8UN.40$Qdgd.15@fx37.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13678&group=comp.lang.tcl#13678

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx37.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: A simple (?) Tk question
Newsgroups: comp.lang.tcl
References: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
Content-Language: en-US
From: Gerald.Lester@gmail.com (Gerald Lester)
In-Reply-To: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 51
Message-ID: <8W8UN.40$Qdgd.15@fx37.iad>
X-Complaints-To: abuse@fastusenet.org
NNTP-Posting-Date: Thu, 18 Apr 2024 13:07:16 UTC
Organization: fastusenet - www.fastusenet.org
Date: Thu, 18 Apr 2024 08:07:16 -0500
X-Received-Bytes: 2228
 by: Gerald Lester - Thu, 18 Apr 2024 13:07 UTC

On 4/17/24 09:21, Helmut Giese wrote:
> Hello out there,
> for a kinf´d of technical app I need a 'switch type' button - that is
> a button stays pressed when pressed once and only gets released when
> pressed again. (Whereas the normal GUI behaviour of buttons is more
> the 'door bell' type).
> I did come as far as keeping it pressed using the code below:
> ---
> package require Tk
> foreach ch [winfo children "."] {destroy $ch}
>
> proc btnPress {w var} {
> if {[set $var]} {
> puts "calling 'tk::ButtonUp $w'"
> tk::ButtonUp $w
> set $var 0
> } else {
> puts "calling 'tk::ButtonDown $w'"
> tk::ButtonDown $w
> set $var 1
> }
> }
>
> proc tst {} {
> set btn [button .btn -width 3 -text ""]
> pack $btn
> set ::${btn}State 0
> bind $btn <Button-1> [list btnPress %W ::${btn}State]
> bind $btn <Enter> {break}
> bind $btn <Leave> {break}
> bind $btn <<Invoke>> {break}
> bind $btn <Key-space> {break}
> bind $btn <ButtonRelease-1> {break}
> return $btn
> }
>
> set b [tst]
> ---
> All the 'break' statements are for disabling the class bindings for
> 'Button'.
> What I see is
> - on the first press the ButtonDown message appears and the button
> gets pressed
> - on following presses I see the Up/Down messages appear as they
> should - but my button never gets released again.
> This is on Windows 10 and Tcl 8.6.10.
>
> Any help will be greatly appreciated
> Helmut

Try checkbutton

Re: A simple (?) Tk question

<ygamspphf17.fsf@panther.akutech-local.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13685&group=comp.lang.tcl#13685

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: A simple (?) Tk question
Date: Fri, 19 Apr 2024 11:34:28 +0200
Lines: 22
Message-ID: <ygamspphf17.fsf@panther.akutech-local.de>
References: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
<yga1q74hxmc.fsf@panther.akutech-local.de>
<t5622jhfmstlc2ba6s90am19nhrfuvhgmb@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net gKH8tVvG/zoaCb2ZnHYC5Aty2+gIQmXPyZczjlhJfkJ6NSq7s=
Cancel-Lock: sha1:Vp5Rvbx1vsJ2Ri6o6XSD/R08pwk= sha1:QDFv8xXnGFnjq1m2VhBgMyde1SM= sha256:ORredCSFEFCnmk9t4FEG9He+BStBxXlMOoFNRVz+2vs=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Fri, 19 Apr 2024 09:34 UTC

* Helmut Giese <hgiese@ratiosoft.com>
| PS: But I still would like to know why that button doesn't go up again

I *think* you need to 'break' in the Button-1 binding as well, since
otherwise the class binding will fire as well and turn the button to
'Pressed' again.

Rather than 'break'-ing in each and every binding you could just remove the
'Button' class bindings via 'bindtag' from that single button:

proc tst {} {
set btn [button .btn -width 3 -text ""]
pack $btn
# !!!
bindtags $btn [list $btn . all]
set ::${btn}State 0
bind $btn <Button-1> [list btnPress %W ::${btn}State]
return $btn
}

HTH
R'

Re: A simple (?) Tk question

<uvv1vu$398ec$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13687&group=comp.lang.tcl#13687

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: et99@rocketship1.me (et99)
Newsgroups: comp.lang.tcl
Subject: Re: A simple (?) Tk question
Date: Fri, 19 Apr 2024 17:24:28 -0700
Organization: A noiseless patient Spider
Lines: 69
Message-ID: <uvv1vu$398ec$1@dont-email.me>
References: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 20 Apr 2024 02:24:30 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a8169e2b5675b96e3b9de1ecc75917ee";
logging-data="3449292"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tGfGmZf1+oKAKPcemF9qO"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:u0Mg4CNG8NnHy9pIcSwEhWsdQzU=
Content-Language: en-US
In-Reply-To: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
 by: et99 - Sat, 20 Apr 2024 00:24 UTC

On 4/17/2024 7:21 AM, Helmut Giese wrote:
> Hello out there,
> for a kinf´d of technical app I need a 'switch type' button - that is
> a button stays pressed when pressed once and only gets released when
> pressed again. (Whereas the normal GUI behaviour of buttons is more
> the 'door bell' type).
> I did come as far as keeping it pressed using the code below:
> ---
> package require Tk
> foreach ch [winfo children "."] {destroy $ch}
>
> proc btnPress {w var} {
> if {[set $var]} {
> puts "calling 'tk::ButtonUp $w'"
> tk::ButtonUp $w
> set $var 0
> } else {
> puts "calling 'tk::ButtonDown $w'"
> tk::ButtonDown $w
> set $var 1
> }
> }
>
> proc tst {} {
> set btn [button .btn -width 3 -text ""]
> pack $btn
> set ::${btn}State 0
> bind $btn <Button-1> [list btnPress %W ::${btn}State]
> bind $btn <Enter> {break}
> bind $btn <Leave> {break}
> bind $btn <<Invoke>> {break}
> bind $btn <Key-space> {break}
> bind $btn <ButtonRelease-1> {break}
> return $btn
> }
>
> set b [tst]
> ---
> All the 'break' statements are for disabling the class bindings for
> 'Button'.
> What I see is
> - on the first press the ButtonDown message appears and the button
> gets pressed
> - on following presses I see the Up/Down messages appear as they
> should - but my button never gets released again.
> This is on Windows 10 and Tcl 8.6.10.
>
> Any help will be greatly appreciated
> Helmut

You could use a label and toggle the relief between raised and sunken.

set lstate 1
label .label -text hello -relief raised
bind .label <1> {toggleit}
proc toggleit {} {
if {[set ::lstate [expr {1-$::lstate}]]} {
.label configure -relief raised
} else {
.label configure -relief sunken
}
} pack .label

-e

Re: A simple (?) Tk question

<slrnv28f0n.1r0mu.avl@logic.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13688&group=comp.lang.tcl#13688

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: avl@logic.at (Andreas Leitgeb)
Newsgroups: comp.lang.tcl
Subject: Re: A simple (?) Tk question
Date: Sat, 20 Apr 2024 22:05:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <slrnv28f0n.1r0mu.avl@logic.at>
References: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
<uvv1vu$398ec$1@dont-email.me>
Reply-To: avl@logic.at
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 21 Apr 2024 00:05:11 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="49e2a72343760fa52572a85a65761d1a";
logging-data="4092339"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eobIml4ipiEZ9mzpZ/7vP"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:KyfTE+BTF/92Ufu6Q7b1do3KVzo=
 by: Andreas Leitgeb - Sat, 20 Apr 2024 22:05 UTC

et99 <et99@rocketship1.me> wrote:
> On 4/17/2024 7:21 AM, Helmut Giese wrote:
>> Hello out there,
>> for a kinf´d of technical app I need a 'switch type' button - that is
>> a button stays pressed when pressed once and only gets released when
>> pressed again. (Whereas the normal GUI behaviour of buttons is more
>> the 'door bell' type).

It was answered already, but might have been missed...

The answer is to use "checkbutton" instead of "button" or "radiobutton".

Re: A simple (?) Tk question

<20240420192133.66e5567905cc52f0900f6397@gmail.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13689&group=comp.lang.tcl#13689

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: emil.gavilan@gmail.com (Emiliano)
Newsgroups: comp.lang.tcl
Subject: Re: A simple (?) Tk question
Date: Sat, 20 Apr 2024 19:21:33 -0300
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <20240420192133.66e5567905cc52f0900f6397@gmail.com>
References: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Injection-Date: Sun, 21 Apr 2024 00:21:35 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0e4bf00fefe2d84b76f8f0fd4072a339";
logging-data="4096129"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dL79ZZdT+3sQdte3F3cCWMioJeBKg6Fw="
Cancel-Lock: sha1:TpCOM7Kr7x4ckvokEKlwq5zxsK8=
X-Newsreader: Sylpheed 3.5.1 (GTK+ 2.24.32; i686-pc-linux-gnu)
 by: Emiliano - Sat, 20 Apr 2024 22:21 UTC

On Wed, 17 Apr 2024 16:21:02 +0200
Helmut Giese <hgiese@ratiosoft.com> wrote:

> Hello out there,
> for a kinf´d of technical app I need a 'switch type' button - that is
> a button stays pressed when pressed once and only gets released when
> pressed again. (Whereas the normal GUI behaviour of buttons is more
> the 'door bell' type).
> I did come as far as keeping it pressed using the code below:
> ---
> package require Tk
> foreach ch [winfo children "."] {destroy $ch}
>
> proc btnPress {w var} {
> if {[set $var]} {
> puts "calling 'tk::ButtonUp $w'"
> tk::ButtonUp $w
> set $var 0
> } else {
> puts "calling 'tk::ButtonDown $w'"
> tk::ButtonDown $w
> set $var 1
> }
> }
>
> proc tst {} {
> set btn [button .btn -width 3 -text ""]
> pack $btn
> set ::${btn}State 0
> bind $btn <Button-1> [list btnPress %W ::${btn}State]
> bind $btn <Enter> {break}
> bind $btn <Leave> {break}
> bind $btn <<Invoke>> {break}
> bind $btn <Key-space> {break}
> bind $btn <ButtonRelease-1> {break}
> return $btn
> }
>
> set b [tst]
> ---
> All the 'break' statements are for disabling the class bindings for
> 'Button'.
> What I see is
> - on the first press the ButtonDown message appears and the button
> gets pressed
> - on following presses I see the Up/Down messages appear as they
> should - but my button never gets released again.
> This is on Windows 10 and Tcl 8.6.10.
>
> Any help will be greatly appreciated
> Helmut

Are you looking for a checkbutton instead? In this case is simply

pack [checkbutton .btn -width 3 -text "" -indicatoron 0 -variable .btnState]

With ttk you can get the same effect with

pack [ttk::checkbutton .btn -width 3 -text "" -style Toolbutton -variable .btnState]

Regards

--
Emiliano

Re: A simple (?) Tk question

<j42a2jpujofffq2gnmpu6pd82475alr23m@4ax.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13694&group=comp.lang.tcl#13694

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: Re: A simple (?) Tk question
Date: Sun, 21 Apr 2024 14:43:52 +0200
Organization: ratiosoft
Lines: 9
Message-ID: <j42a2jpujofffq2gnmpu6pd82475alr23m@4ax.com>
References: <dqlv1jlbpna3lrms01uiv4htvbr5pofv1m@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 21 Apr 2024 14:43:51 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3b0882a6a3ac02d7875b16b908138caf";
logging-data="335770"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nzD7N2GvU1nnrVvyoASTJ"
Cancel-Lock: sha1:HAALNNhP/RM4h/4Wy9pvWyZICWQ=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
 by: Helmut Giese - Sun, 21 Apr 2024 12:43 UTC

Hello,
many thanks to all who responded.
I didn't know it was that easy.
For me a checkbutton always was this square where one could put a
check mark in - hence the name. It never occurred to me that it could
look totally different.
Seems like there is still a lot to learn ...
Thanks again
Helmut

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor