Tkinter - pixel or widget color

2005-04-04 Thread pavel.kosina
I would need to get at canvas pixel color under certain moving widget or 
better (= faster?) colors/"types" of underlying static widgets that are 
of polygon shape (not rectangle).

How to arrange it without using higher math that must have to compute 
actual distance of each of point on a polygon?

I have found find_overlapping() but its not what I need and do not found 
something like getColorPixel().

Pavel
--
http://mail.python.org/mailman/listinfo/python-list


Tkinter slowes down

2005-05-28 Thread pavel.kosina
It seems to me that in my "again and again repainting canvas" script the 
rendering is slowing down as the time goes.

It is visible even after 10 seconds.
Any idea why?

-- 
geon
The exception is rule.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter slowes down

2005-05-28 Thread pavel.kosina
Fredrik Lundh napsal(a):
> when you add an item to the canvas, it's part of the canvas
> until you remove it.  if performance drops, it's usually because
> you keep adding new items without removing the old ones.
> 
> try adding a w.delete(ALL) call before you "repaint".
> 

In the meantime I found that widget.destroy() works well, too (before 
"repainting").

Thanks  a lot

-- 
geon
Vyjímka je pravidlo. Rekurzivní.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter weirdness item count

2005-05-29 Thread pavel.kosina
I think the answer you should find under Subject: Tkinter slowes down


---
geon
Exception is rule.

phil napsal(a):
> Using Tkinter Canvas to teach High School Geometry
> with A LOT of success.
> 
> My drawing gets very slow after a lot of actions.
> 
> For instance I have created code to rotate a set of objects
> about a rotation point.
> rotate 360 degrees starts to get slow
> after 720 degrees its crawling.
> 
> I checked the item list with with find_all: IT GROWS!
> 
> OK, I create 3 lines using a line Class I created.
> When I rotate these 3 lines thru 360 degrees it creates
> 360 lines times 3. But each new instance of line REPLACES
> the old instance.  The line class has a destructor to delete
> the drawn object.
> 
> class line:
> count = 0
> def __init__(s,glob,argl,color=''):
> line.count = line.count + 1
> ##
> ## buncha code here
> ##
> s.obj = glob.can.create_line(x0,y0,x1,y1,
> width=glob.width,fill=s.color)
> def __del__(s):
> line.count = line.count - 1
> 
> ## delete the line object if the
> ## class instance is deleted
> s.glob.can.delete(s.obj)
> 
> 
> After the rotation I check line.count and it is 3
> But find_all returns a tuple ofover 1000 items.
> The drawn objects are not being deleted.
> Which is kinda weird because the rotation works.
> That is they appear to be deleted.
> 
> Is find_all() fooling me?
> Is this the reason drawing slows down? Is it refreshing
> invisible objects?
> 
> This slowing down also occurs when I draw a lot of objects.
> Lets say I draw a sine wave, say 1000 individual points.
> If I draw 4 or 5 sine waves it gets really slow.
> 
> I should mention I call update() after each drawing action.
> This is necessary for the students to watch the progress.
> I might be drawing objects in a lengthy loop and without
> update() they only appear at the end of the loop.
> 
> Thanks for any help.
> 
> -- Confused
> 
> 
-- 
http://mail.python.org/mailman/listinfo/python-list