[Tkinter-discuss] getting started - canvas - "multislider" / function editor

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Thu Feb 14 08:48:58 CET 2008


Tim Mortimer wrote:
> Hello,
> 
> I'm new to GUI programming, & self taught at Python which is the only 
> "real world" programming language i know - I picked it up last year to 
> try and work with Csound to make "algorithmically assisted" 
> compositions, & now hopefully through tkinter some basic interfacing 
> options. (Csound is accesible via python through an api, &/or vice versa...)
> 
> What i want to do is use the Canvas object (assumedly with a series of 
> rectangles on it, let's say 64 or 128 or 256 being the likely number of 
> candidates depending on the editing task..) so that i can graphically 
> edit the contents of function tables in csound.
> 
> The rectangles on the canvas will simply be lenghtened or shortened in 
> the vertical direction, & all sit one next to the other (so it looks 
> like the interface from an EQ on a stereo, or a "skyline" type 
> appearance...maybe coloured rectangles will identify every 8 or 10 or 12 
> index values or something...
> 
> But i've got no experience of this, have run some very simple examples 
> illustrating some basic tkinter behaviour ("hello world" that type of 
> thing...) - but surely there is something around showing some simple 
> canvas operations so i can start hacking it & getting this started, & 
> learning something about tkinter in the process??
> 
> Does anyone know or have an implementation of this type of thing in 
> tkinter, or alternately some simple & pedagogically useful examples of 
> basic canvas & user interfacing types of operations? (resizing boxes on 
> a canvas with the mouse & reporting values being the general idea...)
> 
> many thanks
> 
> Tim


Tim,

The is a tk canvas drag items example in the Python source code I
think... lemme see

Python25/Python-2.5/Demo/tkinter/matt/canvas-moving-w-mouse.py

in fact there are a few, so first grab a tar ball of the source code and
take a look....

While I like the canvas as much as the next guy, have you thought about 
using a 'normal' slider widget? (AKA Tkinter.Scale) these can even be 
put onto a Canvas (via a canvas window item)



Cheers,
Martin.






More information about the Tkinter-discuss mailing list