[pygtk] treeview drag and drop problem

Toon Verstraelen Toon.Verstraelen at UGent.be
Mon Mar 29 19:01:20 WST 2004


Hi,

I've made a simple example in which I enable a drag_source and drag_destiantion 
in an treeview. I used the gtk.gdk.BUTTON1_MASK to ensure that the user can only 
drag with the left mouse button, but it seems that the user can use any button 
to start the drag session. How can I prevent this?

thanks,

Toon

# treeview drag'n'drop problem

import gtk, gtk.gdk

tv = gtk.TreeView()
tv.insert_column_with_attributes(0, "test", gtk.CellRendererText(), text=0)
tm = gtk.ListStore(int)
tv.set_model(tm)

tv.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, [("example", 0, 0)],
                             gtk.gdk.ACTION_DEFAULT)
tv.enable_model_drag_dest([("example", 0, 0)], gtk.gdk.ACTION_DEFAULT)


for i in range(10):
	tm.append([i*i-i])

wi = gtk.Window()
wi.add(tv)

wi.show_all()
gtk.main()


More information about the pygtk mailing list