[pygtk] Drag and Drop icon problems

Adam Olsen arolsen at gmail.com
Wed Jul 26 01:03:45 WST 2006


In the following example, the line that attempts to set the drag and drop
source icon does nothing.   When I start dragging a row, it creates it's own
icon.

If I comment out the lines that set the TreeView as a drag dest, setting the
drag source icon works fine.

How can I set a custom drag source icon if I still want the TreeView to be a
drag destination?

Adam

#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk

class Winder(gtk.Window):
    def __init__(self):
        gtk.Window.__init__(self)

        box =3D gtk.HBox()
        self.add(box)

        model =3D gtk.ListStore(str)
        tree =3D gtk.TreeView(model)
        box.pack_start(tree)

        cell =3D gtk.CellRendererText()
        col =3D gtk.TreeViewColumn('woot', cell, text=3D0)
        tree.append_column(col)


        targets =3D [('text/uri-list', 0, 0)]
        tree.drag_source_set( gtk.gdk.BUTTON1_MASK, targets,
            gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE)

        tree.enable_model_drag_dest(targets,
            gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE)
        tree.drag_source_set_icon_stock('gtk-dnd-multiple')

        for i in range(0, 100):
            model.append(['test_%d' % i])

        self.set_size_request(500, 500)
        self.show_all()

Winder()
gtk.main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20060725/3d681599/at=
tachment.htm


More information about the pygtk mailing list