[PD] [PD-dev] tkwidgets

Jonathan Wilkes jancsika at yahoo.com
Sat Aug 27 04:46:29 CEST 2011


>________________________________
>From: Patrice Colet <colet.patrice at free.fr>
>To: pd-list <pd-list at iem.at>
>Cc: András Murányi <muranyia at gmail.com>; Jonathan Wilkes <jancsika at yahoo.com>; João Pais <jmmmpais at googlemail.com>
>Sent: Friday, August 26, 2011 9:46 PM
>Subject: Re: [PD] [PD-dev] tkwidgets
>
>
>----- "João Pais" <jmmmpais at googlemail.com> a écrit :
>
>> tcl/tk behaves very slowly for fast calls, such as when dragging an
>> array  
>> of considerable size, or a big group of objects? afaik this is
>> something  
>> that could be improved in the present platform, but how better could
>> it be  
>> when using another gui framework?
>> 
>
>This is very slow because everything selected is moving, this method makes a very slow dragging,

Create "Put" menu array, size 1000.  Right-click "properties" and in the "Canvas Properties" dialog, set the 

x size to 1000.  Now you got an array consisting of 1000 separate rectangle items-- to confirm this type the following into the 

tcl prompt (show the prompt using the last item in the "Help" menu):


foreach win [winfo children .] {foreach cwin [winfo children $win] {if {[winfo class $cwin] eq "Canvas"} {foreach item [$cwin find withtag all] {pdtk_post "[$cwin type $item]\n"}}}}

A _little_ sluggish, could be improved (actually it's slightly improved if you draw the points as polygons), but:

Now change the array size in the "Array Properties" dialog to 10000000.  In the "Canvas Properties" dialog, change the x size to 10.  Type the same code as above in the tcl prompt and notice now (if you're drawing the array elements as "points") you've only got 10 rectangles being drawn on the canvas.

The first example is a little annoying, but can be improved by changing the coords (possibly using a single tag for the entire array) rather than deleting and redrawing the array.  The second example can't be blamed on tcl/tk and at large array sizes is _much_ more likely to cause audio dropouts*.


-Jonathan


* because you're never going to need to draw an array with more rectangles than what you have for screen width, which is at most a couple thousand, and even with an array that big it's not maxing out the cpu on my dual-core laptop.


>if a rectangle is drawn just to show up area of selection that is been moving, that would be very fluid,
>and it shouldn't so hard to implement. I guess it would even be possible to capture the selection as an image,
>  so we would drag just an image, and then there would be no difference. 
>
>something like this:
>
><B1-motion> ---> capture area to move, copy in clipboard selected objects and args, build an image or a rectangle, delete the selection, and move the image or rectangle.
><B1-Release> ---> delete the image or rectangle, and paste the selected object(s).
>
>
>> > It might be a good idea to list the problems with tcl/tk so we can
>> weigh  
>> > them against the difficulty of using a different GUI toolkit.  The 
>> 
>> > problems I see are:
>> > * difficult to implement a decent zoom function for a canvas
>> > * can't display png without the Img library (included in 8.6)
>> >
>> > * can't do alpha transparency
>> >
>> >
>> > Of the three I listed, I'm mostly interested in the first as it
>> means  
>> > that (without prior planning) it's hard to take a patch you've been 
>> 
>> > working on at font size 10 and display it adequately over a
>> projector,  
>> > for example.  (If there's a work around I'd like to know it.)
>> > I'd like to hear others, but I'm mostly interested in problems with 
>> 
>> > tcl/tk >= 8.5 as the GUI.
>> 
>> _______________________________________________
>> Pd-list at iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>
>-- 
>Patrice Colet 
>
>
>



More information about the Pd-list mailing list