drag and drop graphics in tkinter?

Lonnie Princehouse finite.automaton at gmail.com
Tue Nov 23 17:56:27 EST 2004


> > I'm looking for a way to use drag-and-dropping to pick up a graphic
> > and move it from one place to another. For example, I thought I could
> > get my feet wet by writing a script to represent small graphs (in the
> > nodes-and-vertices sense) as collections of dots and lines onscreen.
> > Moving the the dots around (while maintaining line-indicated
> > connections between dots) could furnish a graphical way of
> > investigating questions like planarity and isomorphism.

Yep, the canvas widget is the way to go.  You might also take a look
at wxPython instead of Tkinter -- if I recall correctly, there's some
kind of graph widget that might save you some time (run the demo.py
script to find it).   Also, as someone who has spent a lot of time
lately tinkering with graphs, I can highly recommend graphviz.  If you
haven't already looked at it, it's an excellent tool for graph layout.



More information about the Python-list mailing list