[Tutor] Interactive plots...
john at fouhy.net
Fri Mar 28 00:07:02 CET 2008
On 28/03/2008, David Perlman <dperlman at wisc.edu> wrote:
> I am thinking about writing a program which will involve, among other
> things, displaying a plot of a series of numbers. The idea is that
> you could click on the points and move them to change the numbers.
> Reverse-plotting, I suppose. It need not be complex; the numbers
> will all be zero or one, and it's only necessary to flip the bits, so
> click-and-drag is seriously overkill. Really it would be better to
> just double-click on a point to switch it from one value to the other.
> Can anyone point me in the right direction? I have written some
> programs in python before, including TKinter, but this new project is
> beyond the point that I know where to even start looking. :)
You could probably do it with Tkinter -- use a Canvas widget to draw
your points. Each point could just be an oval, and you can bind
events to canvas items in a similar fashion to binding to buttons. So
you would bind on click (or double-click) an event to move the point
If you want to drag points around, it's possible too, the bindings
just become a bit more complex. I think there are recipes or examples
around on the net that you can probably find.
More information about the Tutor