Moving text in canvas is sometimes slow 
Author Message
 Moving text in canvas is sometimes slow

Hi, folks

I have a question about the behaviour of Tk when drawing text in a canvas.
To see it start this small program:

canvas .c -scrollregion {0 0 600 400}
pack .c -fill both -expand true
bind .c <Motion> \
  {.c delete text
   .c create text %x %y -text \
   "This is a very long text moving over the screen" -font 12x24 -tag text
   update idletasks}
bind .c <Button-1> \
  {.c create text %x %y -text "The locked text" -font 12x24 -tag locked
   update idletasks}

When you are moving the text with the mouse cursor, it slides very roughly
over the screen till you place the text. Then it follows much faster.

Has anyone suggestions about this ? How can I reach the 'fast moving mode'
directly ?

I'm using Tcl7.5/Tk4.1 on Linux 1.3.37 (486DX50).

Many thanks in advance,
Christoph



Sat, 28 Nov 1998 03:00:00 GMT  
 Moving text in canvas is sometimes slow

Quote:

> I have a question about the behaviour of Tk when drawing text in a canvas.
> To see it start this small program:[deleted]
> When you are moving the text with the mouse cursor, it slides very roughly
> over the screen till you place the text. Then it follows much faster.

Works fine under Windows NT.

Charlie

--
--------------------------------------------------


http://public.logica.com/~kempsonc
#include <std/disclaimer.h>



Sat, 28 Nov 1998 03:00:00 GMT  
 Moving text in canvas is sometimes slow

Quote:

> I have a question about the behaviour of Tk when drawing text in a canvas.
> To see it start this small program:
> canvas .c -scrollregion {0 0 600 400}
> pack .c -fill both -expand true
> bind .c <Motion> \
>   {.c delete text
>    .c create text %x %y -text \
>    "This is a very long text moving over the screen" -font 12x24 -tag text
>    update idletasks}
> bind .c <Button-1> \
>   {.c create text %x %y -text "The locked text" -font 12x24 -tag locked
>    update idletasks}
> When you are moving the text with the mouse cursor, it slides very roughly
> over the screen till you place the text. Then it follows much faster.
> Has anyone suggestions about this ? How can I reach the 'fast moving mode'
> directly ?

Christoph,

I don't understand what you mean "then it follows much faster".  However,
you're creating and deleting the item time and again...I wonder if it would
be faster to try it with the 'move' option on a canvas.  On my computer (under
windows 95 at least) it doesn't even need to unpdate idletasks to keep things
happening:

canvas .c -scrollregion {0 0 600 400}
pack .c -fill both -expand true
set oldx -400
set oldy -500
set t1item [.c create text -400 -500 -text "This is a very long text moving over the screen."]
bind .c <Button-1> \
  {.c create text %x %y -text "The locked text" -font 12x24 -tag locked
   update idletasks}

bind .c <Motion> {
   .c move $t1item [expr %x-$oldx] [expr %y-$oldy]
   set oldx %x
   set oldy %y

Quote:
}

---



Sun, 29 Nov 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. moving groups of text items on a canvas

2. vw2.5 sometimes slows down when large

3. "wm deiconify" is sometimes really slow

4. patch: tcl/tk canvas slow for large canvas

5. Why is this _sometimes_ so slow under 4.0?

6. I am trying to copy a text string from a front panel indicator to a text

7. I am trying to copy a text string from a front panel indicator to a text

8. Loops, sometimes it works, sometimes not.

9. Tkinter wart: returned texts are sometimes strings, sometime Unicode strings

10. slow - am I asking too much

11. I am moving to comp.lang.clarion

12. Am I moving to Blinker 5.0?

 

 
Powered by phpBB® Forum Software