Mono, Gtk# and ironpython


Posted: 2007/04/24 19:15:42 | Source | More posts about problem Python

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
clr.AddReference(‘gtk-sharp’)
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
Contents © 2004-2014 Kushal Das - Powered by Shonku