#-- dndtester.glade -- True D'N'D Tester GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True True GTK_POLICY_ALWAYS GTK_POLICY_ALWAYS GTK_SHADOW_IN GTK_CORNER_TOP_LEFT True True True False True GTK_JUSTIFY_LEFT GTK_WRAP_NONE True 0 0 0 0 0 0 #-- / dndtester.glade -- # dndtester.py import pygtk pygtk.require("2.0") import gtk import gtk.glade class DNDTester(object): def __init__(self): filename = 'dndtester.glade' windowname = 'DNDTester' self.wTree = gtk.glade.XML(filename, windowname) self.log_buffer = gtk.TextBuffer() self.setupWidgets() def setupWidgets(self): HANDLERS_AND_METHODS = { "on_dndtester_destroy": self.destroy, "on_drag_data_received": self.on_log_drag_data_received } log = self.wTree.get_widget("log") log.set_buffer(self.log_buffer) self.wTree.signal_autoconnect(HANDLERS_AND_METHODS) def on_log_drag_data_received(self, data): self.log_buffer.insert_at_cursor(data+'\n', len(data)) def destroy(self, data): gtk.mainquit() if __name__ == "__main__": app = DNDTester() gtk.mainloop()