Kushal Das

FOSS and life. Kushal Das talks here.

Mono, Gtk# and ironpython

Todays target was to write a HelloWorld code in Gtk# using ironpython in Mono. you can download the setup file from here.

Got this example. But “import Gtk” failed everytime. At the end Jace found the solution. So, the modified code is:

import clr
import Gtk
def delete_event (o, args):
    Gtk.Application.Quit ()

def say_hi (o, args): print “Hello, World!”

Gtk.Application.Init () w = Gtk.Window (“Hello, Gtk# World”) w.DeleteEvent += delete_event b = Gtk.Button (“Say Hello”) b.Clicked += say_hi w.Add (b) w.ShowAll () Gtk.Application.Run ()

The first two lines made all changes, “import clr” and “clr.AddReference(‘gtk-sharp’)”

comments powered by Disqus