Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

I came, I saw, I deleted all your files.


devel / comp.lang.tcl / How can I insert text in slow motion?

SubjectAuthor
* How can I insert text in slow motion?Luc
+* Re: How can I insert text in slow motion?Rich
|`- Re: How can I insert text in slow motion?lamuzz...@gmail.com
`- Re: How can I insert text in slow motion?Emiliano

1
How can I insert text in slow motion?

<20230322214539.4f50713e@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21584&group=comp.lang.tcl#21584

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: How can I insert text in slow motion?
Date: Wed, 22 Mar 2023 21:45:39 -0300
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <20230322214539.4f50713e@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="a23407424326a499b6904cb396f11355";
logging-data="904668"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19W5nnHs3ceLHhDwQdJ/gHg2/U3fQeI8bM="
Cancel-Lock: sha1:QJp3qmFzZbFvkZhYco6rjreafAc=
 by: Luc - Thu, 23 Mar 2023 00:45 UTC

I made this prototype that types text "in slow motion" into a text
widget. It works as expected in text widgets, but not in labels.
Can someone please help me with this?

------------------------------------
package require Tk
wm withdraw .
catch {destroy .sr}
set ::SRw [toplevel .sr]
wm resizable $::SRw 1 1
tk appname "New project"
wm title $::SRw "New project"

frame $::SRw.outerframe
$::SRw.outerframe configure -background #23ADB5
$::SRw.outerframe configure -padx 6 -pady 4
$::SRw.outerframe configure -relief raised -borderwidth 4
pack $::SRw.outerframe
text $::SRw.outerframe.textbox
$::SRw.outerframe.textbox configure -font {Arial 24}
$::SRw.outerframe.textbox configure -width 40 -height 4
$::SRw.outerframe.textbox configure -background #23ADB5 -fg #ffffff
$::SRw.outerframe.textbox configure -padx 10 -pady 4
pack $::SRw.outerframe.textbox
label $::SRw.outerframe.label
$::SRw.outerframe.label configure
$::SRw.outerframe.label configure -text "Some text."
$::SRw.outerframe.label configure -font {Arial 16}
$::SRw.outerframe.label configure -background #ffffff -foreground #000000
pack $::SRw.outerframe.label -side left

bind $::SRw <Alt_L><q> {exit 0}

proc sleep {time} {
after $time set end 1
vwait end
}

set string "This is a slo mo text insertion test."

for {set x 0} {$x <= [string length $string]} {incr x} {
sleep 150
$::SRw.outerframe.textbox insert end [string index $string $x]
} for {set x 0} {$x <= [string length $string]} {incr x} {
sleep 150
$::SRw.outerframe.label configure -text [string range $string 0 [expr [string length $string] -1]]
}

--
Luc
>>

Re: How can I insert text in slow motion?

<tvgbep$s8qg$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21585&group=comp.lang.tcl#21585

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: How can I insert text in slow motion?
Date: Thu, 23 Mar 2023 01:53:29 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Sender: <rellis@d820.dp100.com>
Message-ID: <tvgbep$s8qg$1@dont-email.me>
References: <20230322214539.4f50713e@lud1.home>
Injection-Date: Thu, 23 Mar 2023 01:53:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1d71ab56fc7bc9cf9c5fd075b9fcda88";
logging-data="926544"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9YQuI30uJ763nukup7t9E"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.19 (x86_64))
Cancel-Lock: sha1:UT/wW/k34YN5A1cFli0gjd7XACA=
 by: Rich - Thu, 23 Mar 2023 01:53 UTC

Luc <luc@sep.invalid> wrote:
> $::SRw.outerframe.label configure -text [string range $string 0 [expr [string length $string] -1]]

Your expr at the end there is a constant during each loop iteration
provided "$string" does not change contents during the loop.

A constant value for the second argumennt to string range is *not* what
you want for your desired output.

Re: How can I insert text in slow motion?

<e1c71f48-18e0-4b32-b1ef-4e8129361159n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21586&group=comp.lang.tcl#21586

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:2c1:b0:3e0:755f:c0e5 with SMTP id a1-20020a05622a02c100b003e0755fc0e5mr2067928qtx.9.1679537433353;
Wed, 22 Mar 2023 19:10:33 -0700 (PDT)
X-Received: by 2002:a25:3d87:0:b0:b6e:361a:c86 with SMTP id
k129-20020a253d87000000b00b6e361a0c86mr971095yba.3.1679537433112; Wed, 22 Mar
2023 19:10:33 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 22 Mar 2023 19:10:32 -0700 (PDT)
In-Reply-To: <tvgbep$s8qg$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=190.139.63.124; posting-account=Cgy5dQoAAADca6APzXXyHNx6hvwj5mk6
NNTP-Posting-Host: 190.139.63.124
References: <20230322214539.4f50713e@lud1.home> <tvgbep$s8qg$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e1c71f48-18e0-4b32-b1ef-4e8129361159n@googlegroups.com>
Subject: Re: How can I insert text in slow motion?
From: lamuzzachiodi@gmail.com (lamuzz...@gmail.com)
Injection-Date: Thu, 23 Mar 2023 02:10:33 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1509
 by: lamuzz...@gmail.com - Thu, 23 Mar 2023 02:10 UTC

Hi,
Rich is ok.
The code could be

for {set x 0} {$x <= [string length $string]} {incr x} {
sleep 150
$::SRw.outerframe.label configure -text [string range $string 0 $x]
}

or backward

for {set x 0} {$x <= [string length $string]} {incr x} {
sleep 150
$::SRw.outerframe.label configure -text [string range $string 0 [expr [string length $string] -$x-1]]
}

Alejandro

Re: How can I insert text in slow motion?

<3a2194b7-307a-406b-9caa-e77a4d31d100n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21657&group=comp.lang.tcl#21657

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ac8:7f83:0:b0:3e4:e076:c4a9 with SMTP id z3-20020ac87f83000000b003e4e076c4a9mr508386qtj.10.1680655090835;
Tue, 04 Apr 2023 17:38:10 -0700 (PDT)
X-Received: by 2002:a05:622a:181f:b0:3db:a6c5:cdb7 with SMTP id
t31-20020a05622a181f00b003dba6c5cdb7mr475205qtc.5.1680655090639; Tue, 04 Apr
2023 17:38:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 4 Apr 2023 17:38:10 -0700 (PDT)
In-Reply-To: <20230322214539.4f50713e@lud1.home>
Injection-Info: google-groups.googlegroups.com; posting-host=190.31.8.142; posting-account=16hMVAoAAADREx1E2sS7dQoH2B688EVR
NNTP-Posting-Host: 190.31.8.142
References: <20230322214539.4f50713e@lud1.home>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3a2194b7-307a-406b-9caa-e77a4d31d100n@googlegroups.com>
Subject: Re: How can I insert text in slow motion?
From: emilianogavilan@gmail.com (Emiliano)
Injection-Date: Wed, 05 Apr 2023 00:38:10 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Emiliano - Wed, 5 Apr 2023 00:38 UTC

El miércoles, 22 de marzo de 2023 a las 21:45:45 UTC-3, Luc escribió:
> I made this prototype that types text "in slow motion" into a text
> widget. It works as expected in text widgets, but not in labels.
> Can someone please help me with this?
>
> ------------------------------------
> package require Tk
> wm withdraw .
> catch {destroy .sr}
> set ::SRw [toplevel .sr]
> wm resizable $::SRw 1 1
> tk appname "New project"
> wm title $::SRw "New project"
>
> frame $::SRw.outerframe
> $::SRw.outerframe configure -background #23ADB5
> $::SRw.outerframe configure -padx 6 -pady 4
> $::SRw.outerframe configure -relief raised -borderwidth 4
> pack $::SRw.outerframe
> text $::SRw.outerframe.textbox
> $::SRw.outerframe.textbox configure -font {Arial 24}
> $::SRw.outerframe.textbox configure -width 40 -height 4
> $::SRw.outerframe.textbox configure -background #23ADB5 -fg #ffffff
> $::SRw.outerframe.textbox configure -padx 10 -pady 4
> pack $::SRw.outerframe.textbox
> label $::SRw.outerframe.label
> $::SRw.outerframe.label configure
> $::SRw.outerframe.label configure -text "Some text."
> $::SRw.outerframe.label configure -font {Arial 16}
> $::SRw.outerframe.label configure -background #ffffff -foreground #000000
> pack $::SRw.outerframe.label -side left
>
> bind $::SRw <Alt_L><q> {exit 0}
>
> proc sleep {time} {
> after $time set end 1
> vwait end
> }
>
> set string "This is a slo mo text insertion test."
>
> for {set x 0} {$x <= [string length $string]} {incr x} {
> sleep 150
> $::SRw.outerframe.textbox insert end [string index $string $x]
> }
> for {set x 0} {$x <= [string length $string]} {incr x} {
> sleep 150
> $::SRw.outerframe.label configure -text [string range $string 0 [expr [string length $string] -1]]
> }
>
> --
> Luc
> >>

Or a bit more tclish:

package require Tk
pack [label .l] -fill x
pack [text .t]

set i 0
set string "This is a slo mo text insertion test."
foreach char [split $string {}] {
after [incr i 150] [list .t insert end $char]
}

foreach char [split $string {}] {
after [incr i 150] [format {
.l configure -text "[.l cget -text]%s"
} $char]
}

Regards


devel / comp.lang.tcl / How can I insert text in slow motion?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor