Quickly create amazing websites for your clients or your business with complete control over every piece, without writing a single line of code. THE #1 WEB CREATION PLATFORM, POWERING OVER 10M WEBSITES WORLDWIDE.Įlementor is the leading website building platform for WordPress, enabling web creators to build professional, pixel-perfect websites with an intuitive visual builder. get_height () print ( "Received pixbuf with width %s px and height %s px" % ( width, height )) win = DragDropWindow () win. get_text () print ( "Received text: %s " % text ) elif info = TARGET_ENTRY_PIXBUF : pixbuf = data. on_drag_data_received ) def on_drag_data_received ( self, widget, drag_context, x, y, data, info, time ): if info = TARGET_ENTRY_TEXT : text = data. _init_ ( self, "Drop something on me!" ) self. set_pixbuf ( pixbuf ) def add_item ( self, text, icon_name ): pixbuf = Gtk. get_value ( selected_iter, COLUMN_PIXBUF ) data. set_text ( text, - 1 ) elif info = TARGET_ENTRY_PIXBUF : pixbuf = self. get_value ( selected_iter, COLUMN_TEXT ) data. 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_ ( self, 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. 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.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |