Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Drag and drop in Tkinter. How difficult is it?

2 views
Skip to first unread message

Marc

unread,
Sep 3, 2003, 10:08:17 PM9/3/03
to
Hi all,

I was thinking about developing a drag and drop application and was curious
how difficult it is to do. Basically I want to have a set of objects that I
move around the screen and drop into place.

Anyone else ever done it? Got any tips?

Thanks,
Marc


Cameron Laird

unread,
Sep 4, 2003, 5:14:08 AM9/4/03
to
In article <ApGdnUgAC6p...@comcast.com>,

Marc <losna...@comcast.net> wrote:
>Hi all,
>
>I was thinking about developing a drag and drop application and was curious
>how difficult it is to do. Basically I want to have a set of objects that I
>move around the screen and drop into place.
.
.
.
LOTS of applications--several I've written, I
know--do this sort of thing. You'll need to
learn about bind(), and most likely the events
<1>
<B1-Motion>
<ButtonRelease-1>
in particular: you'll teach <1> to start a
drag, <B1-Motion> to display the dragged object
moving around the screen, and <ButtonRelease-1>
to finish the drop.

Have you read <URL: http://
groups.google.com/groups?as_q=drag+drop+tkinter&as_ugroup=comp.lang.python >?
--

Cameron Laird <Cam...@Lairds.com>
Business: http://www.Phaseit.net
Personal: http://phaseit.net/claird/home.html

Christos TZOTZIOY

unread,
Sep 4, 2003, 1:11:57 PM9/4/03
to
On Thu, 04 Sep 2003 09:14:08 -0000, rumours say that cla...@lairds.com
(Cameron Laird) might have written:

[Marc]


>>I was thinking about developing a drag and drop application and was curious
>>how difficult it is to do. Basically I want to have a set of objects that I
>>move around the screen and drop into place.

- Cameron -


>LOTS of applications--several I've written, I
>know--do this sort of thing. You'll need to
>learn about bind(), and most likely the events
> <1>
> <B1-Motion>
> <ButtonRelease-1>
>in particular: you'll teach <1> to start a
>drag, <B1-Motion> to display the dragged object
>moving around the screen, and <ButtonRelease-1>
>to finish the drop.
>
>Have you read <URL: http://
>groups.google.com/groups?as_q=drag+drop+tkinter&as_ugroup=comp.lang.python >?

I should add that drag and drop in the same application can be done
easily, but it's hard to do it between your application and others (too
much window manager dependencies...)
--
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.

Cameron Laird

unread,
Sep 4, 2003, 1:37:55 PM9/4/03
to
In article <qeselv8j6tgsg151i...@4ax.com>,
Christos "TZOTZIOY" Georgiou <tz...@sil-tec.gr> wrote:
.
.
.

>I should add that drag and drop in the same application can be done
>easily, but it's hard to do it between your application and others (too
>much window manager dependencies...)
.
.
.
Absolutely. My guess is that the original questioner did *not*
have inter-application drag-and-drop in mind, at least not ini-
tially. Those who want to pursue the subject might find the
references at <URL: http://wiki.tcl.tk/DragAndDrop > helpful.

Marc

unread,
Sep 4, 2003, 3:25:29 PM9/4/03
to
Excellent. Thanks for the head start.

A couple of questions.

1) If I want to have a moving object, and not just a cursor that
represents the moving object, do I need to continually pack and unpack
the widget that holds the object and redraw it to give it the
appearance of moving? I know sometimes the redrawing can cause
applications to flicker too much, destroying the effect. I don't know
if there's an optimum way to do this.

2) Also, in reading I found an old module called Tkdnd (drag and
drop). It was an experimental module that was supposed to be updated
but never was. Now I can't find any more information on it. Does this
module still exist or work?

Thanks,
Marc

Michael Peuser

unread,
Sep 4, 2003, 3:41:47 PM9/4/03
to

"Marc" <losna...@comcast.net> schrieb im Newsbeitrag
news:ApGdnUgAC6p...@comcast.com...

There is a nice example here using an as well nice Tree widget:
http://www.esrf.fr/computing/bliss/guides/python/modules/Tree/Tree.html

Kindly
Michael


Cameron Laird

unread,
Sep 4, 2003, 5:33:25 PM9/4/03
to
In article <4378fa6f.03090...@posting.google.com>,
Marc <mnat...@airmail.net> wrote:
.
.

.
>1) If I want to have a moving object, and not just a cursor that
>represents the moving object, do I need to continually pack and unpack
>the widget that holds the object and redraw it to give it the
>appearance of moving? I know sometimes the redrawing can cause
.
.
.
No! Just move the canvas object to follow the Motion events.

Cameron Laird

unread,
Sep 4, 2003, 5:36:08 PM9/4/03
to
>2) Also, in reading I found an old module called Tkdnd (drag and
>drop). It was an experimental module that was supposed to be updated
>but never was. Now I can't find any more information on it. Does this
>module still exist or work?
.
.
.
'Don't know; 'think it hasn't been maintained in a couple of years.

<URL: http://wiki.tcl.tk/tkdnd > might interest you.

Michael Peuser

unread,
Sep 5, 2003, 3:43:59 PM9/5/03
to

"Marc" <mnat...@airmail.net> schrieb im Newsbeitrag
news:4378fa6f.03090...@posting.google.com...

> Excellent. Thanks for the head start.
>
> A couple of questions.

I think they will be answered when you look at the link (Tree.py) I posted
yesterday ;-)

Kindly
Michael P


0 new messages