gasramachine.blogg.se

Pyton gtk
Pyton gtk







pyton gtk

get_iter ( selected_path ) if info = TARGET_ENTRY_TEXT : text = self. get_selected_items () selected_iter = self. on_drag_data_get ) def on_drag_data_get ( self, widget, drag_context, data, info, time ): selected_path = self. add_item ( "Item 3", "edit-copy" ) self. add_item ( "Item 2", "help-about" ) self. add_item ( "Item 1", "image-missing" ) self. set_pixbuf_column ( COLUMN_PIXBUF ) model = Gtk. drag_source_add_text_targets () class DragSourceIconView ( Gtk. drag_source_set_target_list ( None ) self. drag_source_set_target_list ( targets ) def add_text_targets ( self, button = None ): self. drag_dest_set_target_list ( targets ) self. add_image_targets ( TARGET_ENTRY_PIXBUF, True ) self. add_image_targets () def add_image_targets ( self, button = None ): targets = Gtk. pack_start ( text_button, True, False, 0 ) self. new_with_label_from_widget ( image_button, "Text" ) text_button. pack_start ( image_button, True, False, 0 ) text_button = Gtk. new_with_label_from_widget ( None, "Images" ) image_button. pack_start ( button_box, True, False, 0 ) image_button = Gtk. drop_area, True, True, 0 ) button_box = Gtk. pack_start ( hbox, True, True, 0 ) self. _init_ ( title = "Drag and Drop Demo" ) vbox = Gtk. require_version ( "Gtk", "3.0" ) from gi.repository import Gtk, Gdk, GdkPixbuf ( TARGET_ENTRY_TEXT, TARGET_ENTRY_PIXBUF ) = range ( 2 ) ( COLUMN_TEXT, COLUMN_PIXBUF ) = range ( 2 ) DRAG_ACTION = Gdk. Signals using the Gtk.SelectionData get and set methods.

pyton gtk

With the Gtk.SelectionData variable supplied in the In order to transfer data between the source and destination, you must interact You to connect to additional signals and interact with MoreĬomplex things such as specific drop areas and custom drag icons will require Signal and the destination to connect to the “drag-data-received” signal. Specific functions (such as Gtk.TreeView and Gtk.IconView).Ī basic drag and drop only requires the source to connect to the “drag-data-get” _dest_set() some specialised widgets require the use of Method and then handling the relevant signals on both widgets. Widget which the user drops onto) with the _dest_set() _source_set() method, selecting a drag destination (the (the widget which the user starts the drag from) with the Setting up drag and drop between widgets consists of selecting a drag source Required for the following examples to work.









Pyton gtk