| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/python3-xlib/html/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Sending Events (The Python X Library)</title>
<meta name="description" content="Sending Events (The Python X Library)">
<meta name="keywords" content="Sending Events (The Python X Library)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Event-Handling.html" rel="up" title="Event Handling">
<link href="X-Objects.html" rel="next" title="X Objects">
<link href="Event-Types.html" rel="prev" title="Event Types">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<span id="Sending-Events"></span><div class="header">
<p>
Previous: <a href="Event-Types.html" accesskey="p" rel="prev">Event Types</a>, Up: <a href="Event-Handling.html" accesskey="u" rel="up">Event Handling</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<span id="Sending-Events-1"></span><h3 class="section">5.4 Sending Events</h3>
<p>Clients can send events to each other. Most often these are
general-purpose <code>ClientMessage</code> events, but any event type can be
sent.
</p>
<p>To send an event, an event object must be created. This is done by
instantiating an event class, providing values to all its fields as
keyword parameters. The event is then sent with the <code>send_event()</code>
method:
</p>
<dl>
<dt id="index-send_005fevent-on-Window">Method on Window: <strong>send_event</strong> <em>( event, event_mask = 0, propagate = 0, onerror = None )<!-- /@w --></em></dt>
<dd>
<p>Send <var>event</var> to this window.
</p>
<p>If <var>event_mask</var> is 0, the event is sent to the client that created
the window. Otherwise the event is sent to every client selecting any
of the event types in <var>event_mask</var>.
</p>
<p>If no clients have selected any of the event types and <var>propagate</var>
is true, the X server will search for an ancestor of this window on
which some client has selected any of the event types. For details, see
XSendEvent(3X11).
</p>
</dd></dl>
<dl>
<dt id="index-send_005fevent-on-Display">Method on Display: <strong>send_event</strong> <em>( destination, event, <span class="nolinebreak">event_mask</span> = 0,<!-- /@w --> propagate = 0,<!-- /@w --> onerror = None )<!-- /@w --></em></dt>
<dd>
<p>Send <var>event</var> to <var>destination</var>, which can either be a
<code>Window</code> object or a constant: If <code>X.PointerWindow</code> is
specified, send the event to the window the pointer is in. If
<code>X.InputFocus</code> is specified and the focus window contains the
pointer, send the event to the window that the pointer is in.
Otherwise, send the event to the focus window.
</p>
</dd></dl>
<p>As an example, this creates and sends a <code>ClientMessage</code> event of
the client specific type <code>HELLO_WORLD</code> (an atom), to the window
<code>dest</code> and with the 8-bitformat value <code>"G'day, mate"</code> (which
must be exactly twenty bytes):
</p>
<div class="example">
<pre class="example">cm_event = Xlib.protocol.event.ClientMessage(
window = dest,
client_type = HELLO_WORLD,
data = (8, "G'day mate\0\0\0\0\0\0\0\0\0\0"))
dest.send_event(cm_event)
</pre></div>
<hr>
<div class="header">
<p>
Previous: <a href="Event-Types.html" accesskey="p" rel="prev">Event Types</a>, Up: <a href="Event-Handling.html" accesskey="u" rel="up">Event Handling</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
</body>
</html>