Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #357: I'd love to help you -- it's just that the Boss won't let me near the computer.


comp / comp.lang.tcl / A TkPath question

SubjectAuthor
* A TkPath questionHelmut Giese
+- Re: A TkPath questionHelmut Giese
`- Re: A TkPath questiongreg

1
Subject: A TkPath question
From: Helmut Giese
Newsgroups: comp.lang.tcl
Organization: ratiosoft
Date: Thu, 10 Oct 2024 19:17 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: A TkPath question
Date: Thu, 10 Oct 2024 21:17:51 +0200
Organization: ratiosoft
Lines: 33
Message-ID: <lo9ggjl46mi4lunqaotbdihe2mg8o99vm0@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 10 Oct 2024 21:17:52 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0f731fae2709bde248669d59eb09f8f0";
logging-data="3450714"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189M5hrcR4TDxejFfQb63kx"
Cancel-Lock: sha1:Xka1BCGgb6YzK9t3hYng7Z7TjTA=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
View all headers

Hello out there,
I very much like TkPath and am trying to implement some control
widgets based on it. But I stumbled upon a problem: It seems that
there is no TkPath equivalent to the 'arc' command of the regular Tk
canvas. Below is a simplified example from the TkLib's
'controlwidgets' package:
----
package require Tk
package require tkpath

proc mkGUI {parent} {
set dialcolor lightgreen
set width [$c cget -width]
set xcentre [expr {$width*0.5}]
set ycentre [expr {$width*1.4}]
set t 1.15

set c [tkp::canvas $parent.c -width 250 -height 150 \
-background gray50]
pack $c
$c create arc \
[expr {$xcentre-$width*$t}] [expr {$ycentre-$width*$t}] \
[expr {$xcentre+$width*$t}] [expr {$ycentre+$width*$t}] \
-start 70.5 -extent 37 -style arc -outline $dialcolor \
-width [expr {$ycentre*0.245}]

return $c
} set c [mkGUI ""]
----
Any ideas how to accomplish the same with TkPath would be highly
appreciated.
Helmut

Subject: Re: A TkPath question
From: Helmut Giese
Newsgroups: comp.lang.tcl
Organization: ratiosoft
Date: Thu, 10 Oct 2024 19:51 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: Re: A TkPath question
Date: Thu, 10 Oct 2024 21:51:42 +0200
Organization: ratiosoft
Lines: 19
Message-ID: <0rbggjlmc43ta2ojc8vq9vatjlvnr7konc@4ax.com>
References: <lo9ggjl46mi4lunqaotbdihe2mg8o99vm0@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 10 Oct 2024 21:51:43 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0f731fae2709bde248669d59eb09f8f0";
logging-data="3459429"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19L6nV5gXwANMKX0YLC2E37"
Cancel-Lock: sha1:Cmm5AQVJZ0SO2+5q4S3krL2lKGQ=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
View all headers

To answer my own question: The 'path' item to the rescue. The
description isn't exactly exhaustive but after some experimentation I
came up with the following which is pretty close to my OP:
---
package require Tk
package require tkpath

proc mkGUI {parent} {
set c [tkp::canvas $parent.c -width 250 -height 150 \
-background gray50]
pack $c
$c create path {M 25 36 A 270 270 0 0 1 235 36 L 205 120 \
M 25 36 L 50 120 A 220 220 0 0 1 205 120} -fill lightgreen
return $c
} set c [mkGUI ""]
---
So I'm a happy camper again
Helmut

Subject: Re: A TkPath question
From: greg
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 11 Oct 2024 04:20 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: gregor.ebbing@gmx.de (greg)
Newsgroups: comp.lang.tcl
Subject: Re: A TkPath question
Date: Fri, 11 Oct 2024 06:20:51 +0200
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <vea933$3hj2d$1@dont-email.me>
References: <lo9ggjl46mi4lunqaotbdihe2mg8o99vm0@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 11 Oct 2024 06:20:51 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0efbf41ffc9a931035cc485b070e4ae1";
logging-data="3722317"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ek5c6DJk6lS+JVlc635UbY5dr87XQD38="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:N5M7UjbQhxv0Qw4Pj1nKNsBS8SA=
In-Reply-To: <lo9ggjl46mi4lunqaotbdihe2mg8o99vm0@4ax.com>
Content-Language: de-DE
View all headers

Am 10.10.24 um 21:17 schrieb Helmut Giese:
> Hello out there,
> I very much like TkPath and am trying to implement some control
> widgets based on it. But I stumbled upon a problem: It seems that
> there is no TkPath equivalent to the 'arc' command of the regular Tk
> canvas. Below is a simplified example from the TkLib's
> 'controlwidgets' package:
> ----
> package require Tk
> package require tkpath
>
> proc mkGUI {parent} {
> set dialcolor lightgreen
> set width [$c cget -width]
> set xcentre [expr {$width*0.5}]
> set ycentre [expr {$width*1.4}]
> set t 1.15
>
> set c [tkp::canvas $parent.c -width 250 -height 150 \
> -background gray50]
> pack $c
> $c create arc \
> [expr {$xcentre-$width*$t}] [expr {$ycentre-$width*$t}] \
> [expr {$xcentre+$width*$t}] [expr {$ycentre+$width*$t}] \
> -start 70.5 -extent 37 -style arc -outline $dialcolor \
> -width [expr {$ycentre*0.245}]
>
> return $c
> }
> set c [mkGUI ""]
> ----
> Any ideas how to accomplish the same with TkPath would be highly
> appreciated.
> Helmut
Hello,
only the order changed

package require Tk
package require tkpath

proc mkGUI {parent} {
set dialcolor lightgreen

set c [tkp::canvas $parent.c -width 250 -height 150 -background gray50]
pack $c

set width [$c cget -width]
set xcentre [expr {$width * 0.5}]
set ycentre [expr {$width*1.4}]
set t 1.15

$c create arc \
[expr {$xcentre-$width*$t}] [expr {$ycentre-$width*$t}] \
[expr {$xcentre+$width*$t}] [expr {$ycentre+$width*$t}] \
-start 70.5 -extent 37 -style arc -outline $dialcolor \
-width [expr {$ycentre*0.245}]

return $c
}

set c [mkGUI .]

1

rocksolid light 0.9.8
clearnet tor