Gtk UI Light Language
Add custom parser, remove `parglare`. `gull` as a module.
ae725b2b — fabrixxm 3 years ago
Small fixes, update readme and examples
353b6b0a — fabrixxm 3 years ago
Use a new LocalNameSpace for every GullBuilder instance


browse  log 



You can also use your local clone with git send-email.

#GULL - Gtk UI Light Language

GULL is an experiment in a lightweight UI description language for Gtk

This is a toy and not to be used in any seriuos way. You have been warned.

GULL parse a UI description from file and build the corresponding widget tree.

It's meant to be used as a library, where the user have to connect to event and add logic to the UI, but it can also run as a CLI for previewing the UI file.


  • PyGObjects

#Run example

python -m gull examples/example.gull
python -m gull examples/handy.gull



Load filename and return the top level object instance


Load from string and return the top level object instance


Class decorator. Load filename and use current class as toplevel object


Class decorator. Load from string and use current class as toplevel object

#Example use

Load from file:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

import gull

def clicked(o):

if __name__ == "__main__":
    window = gull.load("test.gull")
    window.connect_after('destroy',  Gtk.main_quit)
    window.button1.connect('clicked', clicked)

Use template from string:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

from gull import Template

UI = """
Gtk.Window {
    title : "Templated"
    Gtk.VBox { 
        Gtk.Button {
            id : button1
            label : "Do Action"
            on_clicked : do_action
        Gtk.Button {
            label : "Quit"
            on_clicked : Gtk.main_quit

class MyWindow(Gtk.Window):
    def do_action(self, *args):

if __name__ == "__main__":
    window = MyWindow()


The description language get inspiration from Qt's QML and from Gtk's XML UI language.

It can:

  • Create objects, from classes in gi.repository of PyGObjects
  • Set object properties. Properties are set on object's props attribute or via set_<prop name>() function, the first the code find. Values can be integers, floats, strings, objects, id referecing other object in file, enum values
  • bind properties
  • connect signals
  • set child properties
  • import python modules
  • import other Gull files as widgets


import Gtk 3.0;

loads gi.repository.Gtk module in namespace, requiring version 3.0 Gtk is set by default and is not required to import it explicitly.

import MyWidget;

looks for "MyWidget.gull" or python's MyWidget module in import paths.

import must be ended by a semicolon.

Gtk.Window { }

creates Gtk.Window instance.

MyWidget { }

creates an instance of the widget tree from imported "MyWidget.gull"

Every file can have one or more imports and exaclty one top-level object.

Gtk.Window {
    title: "Example Application"
    default_width: 600
    default_height: 400
    Gtk.Label {
        id: mylabel
        label: "Hello World"

creates a Gtk.Window instance, sets some properties and add a child Gtk.Label. The special id property sets the widget's name property and allow to refer to the object instnce by id elsewere in file. It's also set as propert in top-level object instance returned by gull.load()

Gtk.Notebook {
    Gtk.Label {
        label: "Hello World"
        packing {
            tab_label: "Page 1"


  • clean code
  • ... mmh nothing else.. it's a toy..