GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Mar 29, 2015 7:25 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Drag and drop documentation (PyGObject)
PostPosted: Tue Jan 13, 2015 10:15 pm 
Familiar Face

Joined: Mon Mar 31, 2014 9:59 pm
Posts: 18
I am trying to understand the documentation about drag and drop at:

I want to set up drag and drop so the Treeview (Liststore) can receive data from other programs like spreadsheets. Having looked at this old PyGTK example ( I know I should set up this method:

TreeView.enable_model_drag_dest(targets, actions)

and that requires these two things:

Gtk.TargetEntry(target, flags, info)

I think I understand DragAction, which gets a 2 to indicate that the data will be copied. But I don't understand what to input for TargetEntry and TargetFlags. The PyGTK example uses these 2 snippets. Is there a better documentation for what these values mean?

          ('text/plain', 0, 1),
          ('TEXT', 0, 2),
          ('STRING', 0, 3), ]

self.treeview.enable_model_drag_source( gtk.gdk.BUTTON1_MASK,

Edit 1:

Some progress. Using this code I can drag the items, but I am not catching the drag event correctly:


        Gtk.TreeView.__init__(self, store)
        targets = []
            targets, Gdk.DragAction.DEFAULT|Gdk.DragAction.MOVE)
        self.enable_model_drag_dest(targets, Gdk.DragAction.DEFAULT)

Setup: GTK 3.12, Python 3.4, Glade 3.18, Matplotlib 1.4, Ubuntu 14.10 (64bit) and Gedit. (

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group