gtk.Socket
gtk.Socket — a container for widgets from other processes.
Synopsis
class gtk.Socket(gtk.Container): |
gtk.Socket Signal Prototypes
gtk.Container Signal Prototypes
def callback( | |
def callback( |
Description
Together with a gtk.Plug
, a gtk.Socket
provides
the ability to embed widgets from one process into another process in a
fashion that is transparent to the user. One process creates a gtk.Socket
widget
and, passes the that widget's window ID to the other process, which then
creates a gtk.Plug
with that
window ID. Any widgets contained in the gtk.Plug
then will
appear inside the first applications window. The socket's window ID is
obtained by using the get_id
()
method. Before using this function, the socket must have been realized, and
added to its parent.
When PyGTK is notified that the embedded window has been
destroyed, then it will destroy the socket as well. You should always,
therefore, be prepared for your sockets to be destroyed at any time when the
main event loop is running. The communication between a gtk.Socket
and a
gtk.Plug
follows
the XEmbed protocol.
Methods
gtk.Socket.add_id
def add_id(window_id
)
| the window ID of a client participating in the XEMBED protocol. |
The add_id
() method adds an XEMBED
client specified by window_id
, such as a gtk.Plug
, to the gtk.Socket
. The
client may be in the same process or in a different process.
To embed a gtk.Plug
in a gtk.Socket
, you can
either:
create the
gtk.Plug
by calling gtk.Plug(), then callgtk.Plug.get_id
() to get the window ID of the plug, and finally pass that to thegtk.Socket.add_id()
; or,call the
gtk.Socket.get_id()
method to get the window ID for the socket, then create thegtk.Plug
by calling gtk.Plug() passing in that ID. Thegtk.Socket
must have already be added into a toplevel window before you can make this call.
gtk.Socket.get_id
def get_id()
Returns : | the window ID for the socket |
The get_id
() method gets the window ID
of a gtk.Socket
widget,
which can then be used to create a client embedded inside the socket, for
instance with gtk.Plug(). The
gtk.Socket
must have already be added into a toplevel window before you can make this
call.
Signals
The "plug-added" gtk.Socket Signal
def callback(socket
, user_param1
, ...
)
| the socket that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "plug-added" signal is emitted when a plug is added to the socket.
The "plug-removed" gtk.Socket Signal
def callback(socket
, user_param1
, ...
)
| the socket that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the gtk.Socket
should not be destroyed. |
The "plug-removed" signal is emitted when a plug is removed from
the socket. The default action is to destroy the gtk.Socket
widget,
so if you want to reuse it you must add a signal handler that returns
True
.