Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > drag and drop graphics in tkinter?

Reply
Thread Tools

drag and drop graphics in tkinter?

 
 
Sean McIlroy
Guest
Posts: n/a
 
      11-23-2004
The subject line essentially says it all. Is there a way to do it? If
so, where do I look to find out how? Any help will be much
appreciated.

Thx,
STM
 
Reply With Quote
 
 
 
 
Eric Brunel
Guest
Posts: n/a
 
      11-23-2004
Sean McIlroy wrote:
> The subject line essentially says it all. Is there a way to do it? If
> so, where do I look to find out how? Any help will be much
> appreciated.
>
> Thx,
> STM


I'm not quite sure I understand your question: drag and drop between what and
what? Two windows in a Tkinter application? A file manager and a Tkinter
application?

If you want to support drag and drop inside a Tkinter application, check the
file Tkdnd.py in the Lib/lib-tk sub-directory of the source Python distribution.

HTH
--
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
 
Reply With Quote
 
 
 
 
Sean McIlroy
Guest
Posts: n/a
 
      11-23-2004
Eric Brunel <> wrote in message news:<41a2fb94$0$8155$>...

> I'm not quite sure I understand your question: drag and drop between what and
> what?


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.
 
Reply With Quote
 
Sean McIlroy
Guest
Posts: n/a
 
      11-23-2004
Eric Brunel <> wrote in message news:<41a2fb94$0$8155$>...

> I'm not quite sure I understand your question: drag and drop between what and
> what?


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.
 
Reply With Quote
 
Diez B. Roggisch
Guest
Posts: n/a
 
      11-23-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.



That's not what commonly is associated with drag-and-drop - the reason
beeing that the interesting thing about drag and drop is to create a sort
of event in the drop-target that is filled with information about _what_
has been dropped - e.g. a file location - and then act accordingly. This is
not so much about the graphical appearance, but much more about protocol
issues.

What you want is to utilize the canvas widget. It can create graphics
primitives, and there are plenty of events available so that you get
noticed when the user picks a node (presumably rendered by a circle) and
drags it around.

I've done that years ago, and tk was quite easy to use. But as its a more
tk-specific question, I suggest you search for tk canvas examples, and
translate them to tkinter.
--
Regards,

Diez B. Roggisch
 
Reply With Quote
 
Lonnie Princehouse
Guest
Posts: n/a
 
      11-23-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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java 2D Graphics Drag and Drop shawleigh17 Java 1 08-27-2012 05:10 PM
Drag and Drop and Generate Graphic backstreetboy Java 0 10-22-2007 08:29 AM
Q:How to "drag and drop" jpg's into html and have the code write itself? mr_cross HTML 11 10-11-2006 10:27 PM
RubyDotNet and Drag and Drop Wayne Vucenic Ruby 3 09-28-2003 09:01 PM
Drag & Drop API: get source component in drop traget 'dragOver' Oliver Klein Java 0 08-24-2003 12:01 PM



Advertisments