Calico Gtk

From IPRE Wiki
Jump to: navigation, search

To create entire GUI applications, use the Gtk library.

Note: to use any Gtk graphic functions, or to access GUI settings, one needs to make sure that the code runs in the graphics thread. The easiest way to to that is to us the Myro.Invoke as show below.

Window

import Gtk
import Myro

def main():
    window = Gtk.Window("Title")
    window.Show()

Myro.Invoke(main)

Button

Continuing from the above:


def addButton():
    button = Gtk.Button("Press me!")
    button.Show()
    window.Add(button)

Myro.Invoke(addButton)

For the complete library API, see http://docs.go-mono.com/index.aspx?link=N:Gtk