Changes

Jump to navigation Jump to search
no edit summary
Line 1: Line 1:  +
= Working With Text on the Clipboard =
 +
 
=== How do I copy and paste text from GTK widgets? ===
 
=== How do I copy and paste text from GTK widgets? ===
   Line 4: Line 6:     
The code below creates a simple gtk.Entry widget where text can be entered. Right below this widget, there is one button to copy text inside of the entry and another to paste text from the clipboard in to the Entry widget. In addition to using the "Copy" and "Paste" buttons, users can also use '''CONTROL-X''', '''CONTROL-C''', and '''CONTROL-V''' to cut, copy and paste text from widgets that implement the Editable interface. The meat of the work is done in short callbacks that are connected to the Copy and Paste buttons. The code for creating the UI has been included primarily for completeness and added clarity.  
 
The code below creates a simple gtk.Entry widget where text can be entered. Right below this widget, there is one button to copy text inside of the entry and another to paste text from the clipboard in to the Entry widget. In addition to using the "Copy" and "Paste" buttons, users can also use '''CONTROL-X''', '''CONTROL-C''', and '''CONTROL-V''' to cut, copy and paste text from widgets that implement the Editable interface. The meat of the work is done in short callbacks that are connected to the Copy and Paste buttons. The code for creating the UI has been included primarily for completeness and added clarity.  
      
<pre>
 
<pre>
Line 45: Line 46:  
</pre>
 
</pre>
    +
Note that when you cut or copy text programmatically, you must first select a region in the widget. That is why we have the call to select_region() in the _copyClipInput_cb method. The -1 argument ensures that all text in the widget is selected. <ref>http://www.pygtk.org/docs/pygtk/class-gtkeditable.html#method-gtkeditable--select-region</ref>
   −
Note that when you cut or copy text programmatically, you must first select a region in the widget. That is why we have the call to select_region() in the _copyClipInput_cb method. The -1 argument ensures that all text in the widget is selected. <ref>http://www.pygtk.org/docs/pygtk/class-gtkeditable.html#method-gtkeditable--select-region</ref>
+
= Working with More Complex Data Structures on the Clipboard =
    
= Notes =
 
= Notes =
 
<references />
 
<references />
Anonymous user

Navigation menu