/usr/share/gtk-doc/html/pygtk/class-gtkclipboard.html is in python-gtk2-doc 2.24.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.Clipboard</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="prev" href="class-gtkcheckmenuitem.html" title="gtk.CheckMenuItem"><link rel="next" href="class-gtkcolorbutton.html" title="gtk.ColorButton"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkcheckmenuitem.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkcolorbutton.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.Clipboard"><a name="class-gtkclipboard"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.Clipboard</h2><p>gtk.Clipboard — an object to store data to
and retrieve data from (new in PyGTK 2.2)</p></div><div class="refsect1" title="Synopsis"><a name="id3641597"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Clipboard</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gtkclipboard.html#constructor-gtkclipboard" title="Constructor">gtk.Clipboard</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>display</code></strong></span><span class="initializer">=gtk.gdk.display_get_default()</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>selection</code></strong></span><span class="initializer">="CLIPBOARD"</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--get-display" title="gtk.Clipboard.get_display">get_display</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--get-owner" title="gtk.Clipboard.get_owner">get_owner</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--store" title="gtk.Clipboard.store">store</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--clear" title="gtk.Clipboard.clear">clear</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--set-can-store" title="gtk.Clipboard.set_can_store">set_can_store</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>targets</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--set-with-data" title="gtk.Clipboard.set_with_data">set_with_data</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>targets</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>get_func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>clear_func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--set-text" title="gtk.Clipboard.set_text">set_text</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>text</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>len</code></strong></span><span class="initializer">=-1</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--set-image" title="gtk.Clipboard.set_image">set_image</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixbuf</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-for-contents" title="gtk.Clipboard.wait_for_contents">wait_for_contents</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>target</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-for-targets" title="gtk.Clipboard.wait_for_targets">wait_for_targets</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-for-text" title="gtk.Clipboard.wait_for_text">wait_for_text</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-for-rich-text" title="gtk.Clipboard.wait_for_rich_text">wait_for_rich_text</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-for-image" title="gtk.Clipboard.wait_for_image">wait_for_image</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-is-target-available" title="gtk.Clipboard.wait_is_target_available">wait_is_target_available</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>target</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-is-uris-available" title="gtk.Clipboard.wait_is_uris_available">wait_is_uris_available</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-is-text-available" title="gtk.Clipboard.wait_is_text_available">wait_is_text_available</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-is-rich-text-available" title="gtk.Clipboard.wait_is_rich_text_available">wait_is_rich_text_available</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-is-image-available" title="gtk.Clipboard.wait_is_image_available">wait_is_image_available</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--request-contents" title="gtk.Clipboard.request_contents">request_contents</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>target</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--request-targets" title="gtk.Clipboard.request_targets">request_targets</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--request-text" title="gtk.Clipboard.request_text">request_text</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--request-rich-text" title="gtk.Clipboard.request_rich_text">request_rich_text</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#method-gtkclipboard--request-image" title="gtk.Clipboard.request_image">request_image</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code><br></pre></td></tr></table><pre class="programlisting">
<span class="bold"><strong>Functions</strong></span>
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkclipboard.html#function-gtk--clipboard-get" title="gtk.clipboard_get">gtk.clipboard_get</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>selection</code></strong></span><span class="initializer">="CLIPBOARD"</span></span>)</code></pre></div><div class="refsect1" title="Ancestry"><a name="id3642320"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
+-- <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard">gtk.Clipboard</a>
</pre></div><div class="refsect1" title="gtk.Clipboard Signal Prototypes"><a name="signal-prototypes-gtkclipboard"></a><h2>gtk.Clipboard Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term">"<a class="link" href="class-gtkclipboard.html#signal-gtkclipboard--owner-change" title='The "owner-change" gtk.Clipboard Signal'>owner-change</a></span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>clipboard</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>event</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" title="Description"><a name="id3642422"></a><h2>Description</h2><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This object is available in PyGTK 2.2 and above.</p></div><p> The <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a>
object represents a clipboard of data shared between different processes or
between different widgets in the same process. Each clipboard is identified
by a name encoded as a <a class="link" href="class-gdkatom.html" title="gtk.gdk.Atom"><code class="classname">gtk.gdk.Atom</code></a>. The
<a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a> is
basically a higher-level interface to the lower-level <a class="link" href="class-gtkselectiondata.html" title="gtk.SelectionData"><code class="classname">gtk.SelectionData</code></a>
and selection interface. The built-in atoms are:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">"PRIMARY"</li><li class="listitem">"SECONDARY"</li><li class="listitem">"CLIPBOARD"</li><li class="listitem">"BITMAP"</li><li class="listitem">"COLORMAP"</li><li class="listitem">"DRAWABLE"</li><li class="listitem">"PIXMAP"</li><li class="listitem">"STRING"</li><li class="listitem">"WINDOW"</li></ul></div><p>Creating a <a class="link" href="class-gdkatom.html" title="gtk.gdk.Atom"><code class="classname">gtk.gdk.Atom</code></a> from
strings can be done with the <a class="link" href="class-gdkatom.html#constructor-gdkatom-intern" title="Constructor">gtk.gdk.atom_intern</a>()
constructor function though <code class="literal">PyGTK</code> will usually do the
conversion under the covers as needed. The name of a <a class="link" href="class-gdkatom.html" title="gtk.gdk.Atom"><code class="classname">gtk.gdk.Atom</code></a> can be
retrieved using the Python <code class="function">str</code>() function:</p><pre class="programlisting">
name = str(atom)
</pre><p>The default clipboard corresponds to the "CLIPBOARD" atom; another
commonly used clipboard is the "PRIMARY" clipboard, which, in X,
traditionally contains the currently selected text.</p><p>To simultaneously support different formats on the clipboard, the
clipboard mechanism allows you to provide callbacks instead of the actual
data. When you set the contents of the clipboard, you can either supply the
data directly (via a method like <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--set-text" title="gtk.Clipboard.set_text"><code class="methodname">set_text</code>()</a>),
or you can supply a callback to be called when the data is needed (via the
<a class="link" href="class-gtkclipboard.html#method-gtkclipboard--set-with-data" title="gtk.Clipboard.set_with_data"><code class="methodname">set_with_data</code>()</a>
method.) Providing a callback also avoids making unnecessary copies of the
data.</p><p>Along with the methods to get the clipboard contents as an arbitrary
data chunk, there is a method to retrieve it as text, the <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-for-text" title="gtk.Clipboard.wait_for_text"><code class="methodname">wait_for_text</code>()</a>
method. This method takes care of determining which formats are advertised
by the clipboard provider, asking for the clipboard in the best available
format and converting the results into the UTF-8 encoding. (The standard
form for representing strings in <code class="literal">GTK</code>+.) </p></div><div class="refsect1" title="Constructor"><a name="constructor-gtkclipboard"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.Clipboard</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>display</code></strong></span><span class="initializer">=gtk.gdk.display_get_default()</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>selection</code></strong></span><span class="initializer">="CLIPBOARD"</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>display</code></strong> :</span></p></td><td>the <a class="link" href="class-gdkdisplay.html" title="gtk.gdk.Display"><code class="classname">gtk.gdk.Display</code></a>
for which the clipboard is to be retrieved or created.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>selection</code></strong> :</span></p></td><td>a string that identifies the clipboard
to use.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the appropriate clipboard object or if no
clipboard already exists, a new one will be created. Once a
clipboard object has been created, it is persistent for all time and
cannot be freed.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This constructor is available in PyGTK 2.2 and above.</p></div><p>Returns the clipboard object for the <a class="link" href="class-gdkdisplay.html" title="gtk.gdk.Display"><code class="classname">gtk.gdk.Display</code></a>
specified by <em class="parameter"><code>display</code></em> and the selection specified by
the string in <em class="parameter"><code>selection</code></em>. Cut/copy/paste menu items
and keyboard shortcuts should use the default clipboard, returned by passing
<code class="literal">"CLIPBOARD"</code> for <em class="parameter"><code>selection</code></em>. The
currently-selected object or text should be provided on the clipboard
identified by <code class="literal">"PRIMARY"</code>. Cut/copy/paste menu items
conceptually copy the contents of the <code class="literal">"PRIMARY"</code> clipboard
to the default clipboard, i.e. they copy the selection to what the user sees
as the clipboard.</p><p>See <a class="ulink" href="http://www.freedesktop.org/standards/clipboards-spec/clipboards.txt" target="_top">
http://www.freedesktop.org/standards/clipboards-spec/clipboards.txt</a>
for a detailed discussion of the "CLIPBOARD" vs. "PRIMARY" selections under
the X window system. On Win32 the <code class="literal">"PRIMARY"</code> clipboard is
essentially ignored.</p><p>It's possible to have arbitrarily named clipboards. If you do
invent new clipboards, you should prefix the selection name with an
underscore (because the ICCCM requires that nonstandard atoms are
underscore-prefixed), and namespace it as well. For example, if your
application called "Foo" has a special-purpose clipboard, you might call it
"_FOO_SPECIAL_CLIPBOARD".</p><p>In PyGTK 2.4 and above, the <em class="parameter"><code>display</code></em>
argument is optional and defaults to the default display returned from the
<a class="link" href="class-gdkdisplay.html#function-gdk--display-get-default" title="gtk.gdk.display_get_default"><code class="function">gtk.gdk.display_get_default</code>()</a>
function.</p><p>In PyGTK 2.4 and above, the <em class="parameter"><code>selection</code></em>
argument is optional and defaults to "CLIPBOARD".</p></div><div class="refsect1" title="Methods"><a name="id3642844"></a><h2>Methods</h2><div class="refsect2" title="gtk.Clipboard.get_display"><a name="method-gtkclipboard--get-display"></a><h3>gtk.Clipboard.get_display</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_display</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the <a class="link" href="class-gdkdisplay.html" title="gtk.gdk.Display"><code class="classname">gtk.gdk.Display</code></a>
associated with the clipboard</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">get_display</code>() method returns the
<a class="link" href="class-gdkdisplay.html" title="gtk.gdk.Display"><code class="classname">gtk.gdk.Display</code></a>
associated with the clipboard.</p></div><div class="refsect2" title="gtk.Clipboard.get_owner"><a name="method-gtkclipboard--get-owner"></a><h3>gtk.Clipboard.get_owner</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_owner</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the owner of the clipboard, if any; otherwise
<code class="literal">None</code>.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">get_owner</code>() method returns the
owner set by the <code class="methodname">set_with_owner</code>() method if neither
the <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--set-with-data" title="gtk.Clipboard.set_with_data"><code class="methodname">set_with_data()</code></a>
method nor the <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--clear" title="gtk.Clipboard.clear"><code class="methodname">clear()</code></a>
method have been subsequently called. This method returns
<code class="literal">None</code> otherwise.</p></div><div class="refsect2" title="gtk.Clipboard.store"><a name="method-gtkclipboard--store"></a><h3>gtk.Clipboard.store</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">store</span>()</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">store</code>() method stores the current
clipboard data (as specified by the <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--set-can-store" title="gtk.Clipboard.set_can_store"><code class="methodname">set_can_store</code>()</a>
method) somewhere so that it will stay around after the application has
quit.</p></div><div class="refsect2" title="gtk.Clipboard.clear"><a name="method-gtkclipboard--clear"></a><h3>gtk.Clipboard.clear</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">clear</span>(<span class="methodparam"></span>)</code></pre><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">clear</code>() method clears the contents
of the clipboard. Generally this should only be called between the time you
call the <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--set-with-data" title="gtk.Clipboard.set_with_data"><code class="methodname">set_with_data()</code></a>,
and when the <em class="parameter"><code>clear_func</code></em> you supplied is
called. Otherwise, the clipboard may be owned by someone else.</p></div><div class="refsect2" title="gtk.Clipboard.set_can_store"><a name="method-gtkclipboard--set-can-store"></a><h3>gtk.Clipboard.set_can_store</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_can_store</span>()</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>targets</code></strong> :</span></p></td><td>a list of 3-tuples containing information about
the available forms that should be stored or <code class="literal">None</code> to
indicate that all forms should be stored.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">set_can_store</code>() method sets a hint
that the <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a> can
store the list of targets specified by <em class="parameter"><code>targets</code></em> can be
stored somewhere when the application exits or when the <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--store" title="gtk.Clipboard.store"><code class="methodname">store</code>()</a>
method is called. This value is reset when the clipboard owner
changes. Where the clipboard data is stored is platform dependent, see the
<a class="link" href="class-gdkdisplay.html#method-gdkdisplay--store-clipboard" title="gtk.gdk.Display.store_clipboard"><code class="methodname">gtk.gdk.Display.store_clipboard</code>()</a>
method for more information. If <em class="parameter"><code>targets</code></em> is
<code class="literal">None</code> all target forms currently available on the
clipboard should be stored.</p><p>The 3-tuples listed in <em class="parameter"><code>targets</code></em> contain
the following items:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">a string representing a target supported by the
clipboard</li><li class="listitem">a flags value used for drag and drop - a combination of:
<code class="literal">gtk.TARGET_SAME_APP</code> and
<code class="literal">gtk.TARGET_SAME_WIDGET</code></li><li class="listitem">an application assigned integer that is passed as a signal
parameter to help identify the target type</li></ul></div></div><div class="refsect2" title="gtk.Clipboard.set_with_data"><a name="method-gtkclipboard--set-with-data"></a><h3>gtk.Clipboard.set_with_data</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_with_data</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>targets</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>get_func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>clear_func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>targets</code></strong> :</span></p></td><td>a list of 3-tuples containing information about
the available forms for the clipboard data</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>get_func</code></strong> :</span></p></td><td>a function to call to get the actual clipboard
data</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>clear_func</code></strong> :</span></p></td><td>when the clipboard contents are set again,
this function will be called, and <em class="parameter"><code>get_func</code></em> will not
be subsequently called.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>user_data</code></strong> :</span></p></td><td>the user data to pass to
<em class="parameter"><code>get_func</code></em> and
<em class="parameter"><code>clear_func</code></em>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if setting the
clipboard data succeeded. If setting the clipboard data failed the
provided callback functions will be ignored.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">set_with_data</code>() method virtually
sets the contents of the specified clipboard by providing a list of
supported formats (specified by <em class="parameter"><code>targets</code></em>) for the
clipboard data and a function (specified by <em class="parameter"><code>get_func</code></em>)
to call to get the actual data when it is
requested. <em class="parameter"><code>clear_func</code></em> is a function that is called
when the contents of the clipboard are being changed to provide cleanup
operations on
<em class="parameter"><code>user_data</code></em>. <em class="parameter"><code>user_data</code></em> is passed
to <em class="parameter"><code>get_func</code></em> and <em class="parameter"><code>clear_func</code></em>
when they are invoked. The 3-tuples listed in <em class="parameter"><code>targets</code></em>
contain the following items:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">a string representing a target supported by the
clipboard</li><li class="listitem">a flags value used for drag and drop - a combination of:
<code class="literal">gtk.TARGET_SAME_APP</code> and
<code class="literal">gtk.TARGET_SAME_WIDGET</code></li><li class="listitem">an application assigned integer that is passed as a signal
parameter to help identify the target type</li></ul></div><p>The signature of <em class="parameter"><code>get_func</code></em> is:</p><pre class="programlisting">
def get_func(clipboard, selectiondata, info, data):
</pre><p>where <em class="parameter"><code>clipboard</code></em> is the <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a>,
<em class="parameter"><code>selectiondata</code></em> is a <a class="link" href="class-gtkselectiondata.html" title="gtk.SelectionData"><code class="classname">gtk.SelectionData</code></a>
object to set with the data, <em class="parameter"><code>info</code></em> is the application
assigned integer associated with a target, and <em class="parameter"><code>data</code></em>
is the <em class="parameter"><code>user_data</code></em> argument.</p><p>The signature of <em class="parameter"><code>clear_func</code></em> is:</p><pre class="programlisting">
def clear_func(clipboard, data):
</pre><p>where <em class="parameter"><code>clipboard</code></em> is the <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a> and
<em class="parameter"><code>data</code></em> is the <em class="parameter"><code>user_data</code></em>
argument.</p></div><div class="refsect2" title="gtk.Clipboard.set_text"><a name="method-gtkclipboard--set-text"></a><h3>gtk.Clipboard.set_text</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_text</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>text</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>len</code></strong></span><span class="initializer">=-1</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>text</code></strong> :</span></p></td><td>a string.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>len</code></strong> :</span></p></td><td>the length of <em class="parameter"><code>text</code></em>, in
bytes, or -1, to calculate the length.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">set_text</code>() method sets the contents
of the clipboard to the string specified by <em class="parameter"><code>text</code></em>. If
<em class="parameter"><code>len</code></em> is given it determines the length of
<em class="parameter"><code>text</code></em> to be copied. If <em class="parameter"><code>len</code></em> is
not specified it defaults to -1 and the method calculates the text
length.</p></div><div class="refsect2" title="gtk.Clipboard.set_image"><a name="method-gtkclipboard--set-image"></a><h3>gtk.Clipboard.set_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_image</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixbuf</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pixbuf</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>The <code class="methodname">set_image</code>() method sets the
contents of the clipboard to the <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
specified by <em class="parameter"><code>pixbuf</code></em>. GTK+ will take responsibility
for responding for requests for the image, and for converting the image into
the requested format.</p></div><div class="refsect2" title="gtk.Clipboard.wait_for_contents"><a name="method-gtkclipboard--wait-for-contents"></a><h3>gtk.Clipboard.wait_for_contents</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_for_contents</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>target</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>target</code></strong> :</span></p></td><td>an atom or string representing the form into
which the clipboard owner should convert the selection.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a newly-allocated <a class="link" href="class-gtkselectiondata.html" title="gtk.SelectionData"><code class="classname">gtk.SelectionData</code></a>
object or <code class="literal">None</code> if retrieving the given target
failed.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">wait_for_contents</code>() method requests
the contents of the clipboard using the target specified by
<em class="parameter"><code>target</code></em>. This method waits for the data to be received
using the main loop, so events, timeouts, etc, may be dispatched during the
wait.</p></div><div class="refsect2" title="gtk.Clipboard.wait_for_targets"><a name="method-gtkclipboard--wait-for-targets"></a><h3>gtk.Clipboard.wait_for_targets</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_for_targets</span>()</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>returns a tuple containing any targets that are
present on the clipboard or <code class="literal">None</code>.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">wait_for_targets</code>() method returns a
tuple containing the targets (as <a class="link" href="class-gdkatom.html" title="gtk.gdk.Atom"><code class="classname">gtk.gdk.Atom</code></a> objects)
that are present on the clipboard, or <code class="literal">None</code> if there
aren't any targets available. This function waits for the data to be
received using the main loop, so events, timeouts, etc, may be dispatched
during the wait.</p></div><div class="refsect2" title="gtk.Clipboard.wait_for_text"><a name="method-gtkclipboard--wait-for-text"></a><h3>gtk.Clipboard.wait_for_text</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_for_text</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a string, or <code class="literal">None</code> if
retrieving the selection data failed. (This could happen for various reasons,
in particular if the clipboard was empty or if the contents of the
clipboard could not be converted into text form.)</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">wait_for_text</code>() method requests the
contents of the clipboard as text and converts the result to UTF-8 if
necessary. This method waits for the data to be received using the main
loop, so events, timeouts, etc, may be dispatched during the wait.</p></div><div class="refsect2" title="gtk.Clipboard.wait_for_rich_text"><a name="method-gtkclipboard--wait-for-rich-text"></a><h3>gtk.Clipboard.wait_for_rich_text</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_for_rich_text</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>buffer</code></strong> :</span></p></td><td>a <a class="link" href="class-gtktextbuffer.html" title="gtk.TextBuffer"><code class="classname">gtk.TextBuffer</code></a>
to retrieve the deserialize formats from.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a 2-tuple containing the rich text as a string
and the format string , or <code class="literal">None</code> if retrieving
the selection data failed. (This could happen for various reasons,
in particular if the clipboard was empty or if the contents of the
clipboard could not be converted into text
form.)</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>The <code class="methodname">wait_for_rich_text</code>() method
requests the contents of the clipboard as rich text. This method
waits for the data to be received using the main loop, so events,
timeouts, etc, may be dispatched during the wait.</p></div><div class="refsect2" title="gtk.Clipboard.wait_for_image"><a name="method-gtkclipboard--wait-for-image"></a><h3>gtk.Clipboard.wait_for_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_for_image</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>,
or <code class="literal">None</code> if retrieving the selection data failed.
(This could happen for various reasons, in particular if the clipboard was
empty or if the contents of the clipboard could not be converted into an
image.)</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>The <code class="methodname">wait_for_image</code>() method requests
the contents of the clipboard as an image and converts the result to a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>. This
method waits for the data to be received using the main loop, so events,
timeouts, etc, may be dispatched during the wait.</p></div><div class="refsect2" title="gtk.Clipboard.wait_is_target_available"><a name="method-gtkclipboard--wait-is-target-available"></a><h3>gtk.Clipboard.wait_is_target_available</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_is_target_available</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>target</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>target</code></strong> :</span></p></td><td>an atom or string representing the target of
interest.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the target is
available.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">wait_is_target_available</code>() method
tests to see if the target specified by <em class="parameter"><code>target</code></em> is
available to be copied from the clipboard. This method can be used to
determine if a <span class="guimenuitem">Paste</span> menu item should be
insensitive or not.</p><p>If you want to see if there's text available on the clipboard,
use the <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-is-text-available" title="gtk.Clipboard.wait_is_text_available"><code class="methodname">wait_is_text_available</code>()</a>
method instead.</p></div><div class="refsect2" title="gtk.Clipboard.wait_is_uris_available"><a name="method-gtkclipboard--wait-is-uris-available"></a><h3>gtk.Clipboard.wait_is_uris_available</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_is_uris_available</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if is there is an URI list
available, <code class="literal">False</code>
otherwise.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.14 and above.</p></div><p>
The <code class="methodname">wait_is_uris_available</code>()
method Test to see if there is a list of URIs available to be pasted This
is done by requesting the TARGETS atom and checking if it contains the URI targets.
This function waits for the data to be received using the main loop, so events,
timeouts, etc, may be dispatched during the wait.
</p></div><div class="refsect2" title="gtk.Clipboard.wait_is_text_available"><a name="method-gtkclipboard--wait-is-text-available"></a><h3>gtk.Clipboard.wait_is_text_available</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_is_text_available</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> is there is text
available.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">wait_is_text_available</code>() method
tests to see if there is text available to be copied from the clipboard.
This is done by requesting the "TARGETS" atom and checking if it contains
any of the names: "STRING", "TEXT", "COMPOUND_TEXT", "UTF8_STRING". This
method waits for the data to be received using the main loop, so events,
timeouts, etc, may be dispatched during the wait.</p><p>This method is a little faster than calling the <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-for-text" title="gtk.Clipboard.wait_for_text"><code class="methodname">wait_for_text()</code></a>
since it doesn't need to retrieve the actual text.</p></div><div class="refsect2" title="gtk.Clipboard.wait_is_rich_text_available"><a name="method-gtkclipboard--wait-is-rich-text-available"></a><h3>gtk.Clipboard.wait_is_rich_text_available</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_is_rich_text_available</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>buffer</code></strong> :</span></p></td><td>a <a class="link" href="class-gtktextbuffer.html" title="gtk.TextBuffer"><code class="classname">gtk.TextBuffer</code></a>
to retrieve the deserialize formats from.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if is there is rich
text available, <code class="literal">False</code>
otherwise.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>The <code class="methodname">wait_is_rich_text_available</code>()
method tests to see if there is rich text available to be pasted. This
is done by requesting the <code class="literal">TARGETS</code> atom and checking
if it contains any of the supported rich text targets. This method
waits for the data to be received using the main loop, so events,
timeouts, etc, may be dispatched during the wait.</p><p>This method is a little faster than calling <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-for-rich-text" title="gtk.Clipboard.wait_for_rich_text"><code class="methodname">wait_for_rich_text()</code></a>
since it doesn't need to retrieve the actual text.</p></div><div class="refsect2" title="gtk.Clipboard.wait_is_image_available"><a name="method-gtkclipboard--wait-is-image-available"></a><h3>gtk.Clipboard.wait_is_image_available</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">wait_is_image_available</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> is there is an image
available.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>The <code class="methodname">wait_is_image_available</code>() method
tests to see if there is an image available to be copied from the clipboard.
This is done by requesting the "TARGETS" atom and checking if it contains
any of the supported image targets. This method waits for the data to be
received using the main loop, so events, timeouts, etc, may be dispatched
during the wait.</p><p>This method is a little faster than calling the <a class="link" href="class-gtkclipboard.html#method-gtkclipboard--wait-for-image" title="gtk.Clipboard.wait_for_image"><code class="methodname">wait_for_image()</code></a>
since it doesn't need to retrieve the actual image data.</p></div><div class="refsect2" title="gtk.Clipboard.request_contents"><a name="method-gtkclipboard--request-contents"></a><h3>gtk.Clipboard.request_contents</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">request_contents</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>target</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>target</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkatom.html" title="gtk.gdk.Atom"><code class="classname">gtk.gdk.Atom</code></a>
or string representing the form that the clipboard owner should convert
the selection to.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>callback</code></strong> :</span></p></td><td>a function to call when the results are received
(or the retrieval fails).</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>user_data</code></strong> :</span></p></td><td>user data to pass to <em class="parameter"><code>callback</code></em></td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">request_contents</code>() method requests
the contents of clipboard in the form specified by
<em class="parameter"><code>target</code></em>. When the results of the request are later
received the function specified by <em class="parameter"><code>callback</code></em> will be
invoked and passed the data specified by
<em class="parameter"><code>user_data</code></em>. The signature of
<em class="parameter"><code>callback</code></em> is:</p><pre class="programlisting">
def callback(clipboard, selection_data, data):
</pre><p>where <em class="parameter"><code>clipboard</code></em> is the <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a>
that invoked callback and <em class="parameter"><code>selection_data</code></em> is the <a class="link" href="class-gtkselectiondata.html" title="gtk.SelectionData"><code class="classname">gtk.SelectionData</code></a>
containing the target data and <em class="parameter"><code>data</code></em> is
<em class="parameter"><code>user_data</code></em>.</p></div><div class="refsect2" title="gtk.Clipboard.request_targets"><a name="method-gtkclipboard--request-targets"></a><h3>gtk.Clipboard.request_targets</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">request_targets</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>callback</code></strong> :</span></p></td><td>a function to call when the targets are received,
or the retrieval fails. (It will always be called
one way or the other.)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>user_data</code></strong> :</span></p></td><td>user data to pass to
<em class="parameter"><code>callback</code></em>.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">request_targets</code>() method requests
the contents of the clipboard as list of supported targets. When the list
is later received, <em class="parameter"><code>callback</code></em> will be called with the
data specified by <em class="parameter"><code>user_data</code></em>. The signature of
<em class="parameter"><code>callback</code></em> is:</p><pre class="programlisting">
def callback(clipboard, targets, data):
</pre><p>where <em class="parameter"><code>clipboard</code></em> is the <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a>
that <em class="parameter"><code>targets</code></em> is retrieved
from. <em class="parameter"><code>targets</code></em> is a tuple containing the <a class="link" href="class-gdkatom.html" title="gtk.gdk.Atom"><code class="classname">gtk.gdk.Atom</code></a> objects
corresponding to the targets of clipboard. <em class="parameter"><code>targets</code></em>
will contain the resulting targets if the request succeeded, or an empty
tuple if it failed.</p></div><div class="refsect2" title="gtk.Clipboard.request_text"><a name="method-gtkclipboard--request-text"></a><h3>gtk.Clipboard.request_text</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">request_text</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>callback</code></strong> :</span></p></td><td>a function to call when the text is received,
or the retrieval fails. (It will always be called
one way or the other.)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>user_data</code></strong> :</span></p></td><td>user data to pass to
<em class="parameter"><code>callback</code></em>.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">request_text</code>() method requests the
contents of the clipboard as text. When the text is later received, it will
be converted to UTF-8 if necessary, and <em class="parameter"><code>callback</code></em> will
be called with the data specified by <em class="parameter"><code>user_data</code></em>. The
signature of <em class="parameter"><code>callback</code></em> is:</p><pre class="programlisting">
def callback(clipboard, text, data):
</pre><p>where <em class="parameter"><code>clipboard</code></em> is the <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a>
that <em class="parameter"><code>text</code></em> is retrieved from and
<em class="parameter"><code>data</code></em> is <em class="parameter"><code>user_data</code></em>.
<em class="parameter"><code>text</code></em> will contain the resulting text if the request
succeeded, or the empty string if it failed. This could happen for various
reasons, in particular if the clipboard was empty or if the contents of the
clipboard could not be converted into text form.</p></div><div class="refsect2" title="gtk.Clipboard.request_rich_text"><a name="method-gtkclipboard--request-rich-text"></a><h3>gtk.Clipboard.request_rich_text</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">request_rich_text</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>buffer</code></strong> :</span></p></td><td>a <a class="link" href="class-gtktextbuffer.html" title="gtk.TextBuffer"><code class="classname">gtk.TextBuffer</code></a>
to retrieve the deserialize formats from.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>callback</code></strong> :</span></p></td><td>a function to call when the text is received,
or the retrieval fails. (It will always be called one way or the
other.)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>user_data</code></strong> :</span></p></td><td>user data to pass to
<em class="parameter"><code>callback</code></em>.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>The <code class="methodname">request_rich_text</code>() method requests
the contents of the clipboard as rich text. When the rich text is
later received, the function specified by
<em class="parameter"><code>callback</code></em> will be called with the argument
specified by <em class="parameter"><code>user_data</code></em>.</p><p>The signature of the callback is:</p><pre class="programlisting">
def callback(clipboard, format, text, length, data):
</pre><p>where <em class="parameter"><code>format</code></em> is the atom indicating the
text format, <em class="parameter"><code>text</code></em> contains the resulting rich
text if the request succeeded, or <code class="literal">None</code> if it
failed, <em class="parameter"><code>length</code></em> contains the length of
<em class="parameter"><code>text</code></em> and <em class="parameter"><code>data</code></em> is
<em class="parameter"><code>user_data</code></em>. This function can fail for various
reasons, in particular if the clipboard was empty or if the contents
of the clipboard could not be converted into rich text form.</p></div><div class="refsect2" title="gtk.Clipboard.request_image"><a name="method-gtkclipboard--request-image"></a><h3>gtk.Clipboard.request_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">request_image</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>callback</code></strong> :</span></p></td><td>a function to call when the image is received,
or the retrieval fails. (It will always be called
one way or the other.)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>user_data</code></strong> :</span></p></td><td>user data to pass to
<em class="parameter"><code>callback</code></em>.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.10 and above.</p></div><p>The <code class="methodname">request_image</code>() method requests the
contents of the clipboard as a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
image. When the image is later received, it will be converted to a <a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a> and
<em class="parameter"><code>callback</code></em> will be called with the data specified by
<em class="parameter"><code>user_data</code></em>. The signature of
<em class="parameter"><code>callback</code></em> is:</p><pre class="programlisting">
def callback(clipboard, pixbuf, data):
</pre><p>where <em class="parameter"><code>clipboard</code></em> is the <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a>
that <em class="parameter"><code>pixbuf</code></em> is retrieved from and
<em class="parameter"><code>data</code></em> is <em class="parameter"><code>user_data</code></em>.
<em class="parameter"><code>pixbuf</code></em> will contain the resulting image data if the
request succeeded, or <code class="literal">None</code> if it failed. This could
happen for various reasons, in particular if the clipboard was empty or if
the contents of the clipboard could not be converted into an image.</p></div></div><div class="refsect1" title="Functions"><a name="id3645666"></a><h2>Functions</h2><div class="refsect2" title="gtk.clipboard_get"><a name="function-gtk--clipboard-get"></a><h3>gtk.clipboard_get</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.clipboard_get</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>selection</code></strong></span><span class="initializer">="CLIPBOARD"</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>selection</code></strong> :</span></p></td><td>a string specifying a <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a>. If
not specified it defaults to "CLIPBOARD".</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the appropriate clipboard object or if no
clipboard already exists, a new one will be created. Once a
clipboard object has been created, it is persistent for all time and
cannot be freed.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.4 and above.</p></div><p>The <code class="function">gtk.clipboard_get</code>() function returns
the <a class="link" href="class-gtkclipboard.html" title="gtk.Clipboard"><code class="classname">gtk.Clipboard</code></a>
specified by selection for the default <a class="link" href="class-gdkdisplay.html" title="gtk.gdk.Display"><code class="classname">gtk.gdk.Display</code></a>. See
the <a class="link" href="class-gtkclipboard.html#constructor-gtkclipboard" title="Constructor">gtk.Clipboard</a>
constructor for more information.</p></div></div><div class="refsect1" title="Signals"><a name="id3645783"></a><h2>Signals</h2><div class="refsect2" title='The "owner-change" gtk.Clipboard Signal'><a name="signal-gtkclipboard--owner-change"></a><h3>The "owner-change" gtk.Clipboard Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>clipboard</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>event</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>clipboard</code></em> :</span></p></td><td>the object that received the signal.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>event</code></em> :</span></p></td><td>the event marking the ownership
change.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if any)</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This signal is available in GTK+ 2.8 and above.</p></div><p>The "owner-changed" signal is emitted when the owner of the
clipboard is changed.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtkcheckmenuitem.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gtkcolorbutton.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.CheckMenuItem </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.ColorButton</td></tr></table></div></body></html>
|