A Plug object allows an interface to be embedded in a parent (known as a Socket) to provide a frontend which is run in a separate process.


A Plug and Socket can also be used on an X11 supported system (e.g. Linux, BSD, Solaris).


The Plug can be constructed using the following:

plug =

When a Socket is created, it will return a socket_id value which identifies itself uniquely. The socket_id should be converted into an integer value.


The ID number of a Plug can be retrieved via:

id = plug.get_id()

To check whether a Plug is currently embedded in a Socket use:

embedded = plug.get_embedded()

When the Plug is embedded, the embedded value returns True.


The commonly used signals of an Plug are:

"embedded" (plug)

An “embedded” event is emitted from the Plug when it is attached to a Socket. When the signal occurs, the Plug is passed as part of the event.


Below is an example of a Plug:

#!/usr/bin/env python3

from gi.repository import Gtk
import sys

def embed_event(widget):
    print("A plug has been embedded")

if len(sys.argv) == 2:
    socket_id = sys.argv[1]
    socket_id = int(socket_id)

plug =
plug.connect("embedded", embed_event)
plug.connect("destroy", Gtk.main_quit)

print("Plug ID:", plug.get_id())

entry = Gtk.Entry()



Download: Plug