I've been trying to make a simple IronPython+Gtk# app that draws an image to the screen, and I'm having trouble getting it to run in windows (.NET). It's pretty simple so I attached it at the end.

It runs fine in Mono on Ubuntu and Windows, but when I try to run it on windows using .NET I get the following error followed by a really long calltrace:

Marshaling expose_event signal
Exception in Gtk# callback delegate
Note: Applications can use GLib.ExceptionManager.UnhandledException to handle
the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the ta rget of an invocation. ---> System.NotSupportedException: The invoked member is
not supported in a dynamic assembly.
  at System.Reflection.Emit.AssemblyBuilder.get_Location()
  at GLib.GType.LookupType(IntPtr typeid)
  at ...


I have the latest 'Gtk# for .NET' package from the Mono site, and I've tried with IP 2.0.1 and IP 2.6 Beta, they give the same results. I rewrote the program in C# and it works fine in .NET (without Mono), using #Develop IDE.

Is this possible?

code:

import clr
clr.AddReference('gtk-sharp')
clr.AddReference('gdk-sharp')
import Gtk
import Gdk


class MyWindow(Gtk.Window):
   def __init__(self, title='Main Window'):
       Gtk.Window.__init__(self, title)
self.pb = Gdk.Pixbuf('image.jpg').ScaleSimple(600,436, Gdk.InterpType.Bilinear )
       self.da = Gtk.DrawingArea()
       self.da.SetSizeRequest(self.pb.Width, self.pb.Height)
       self.Add(self.da)
       self.Decorated = False
self.DeleteEvent += self.delete_event self.da.ExposeEvent += self.expose_event

   def expose_event(self, *args):
self.da.GdkWindow.DrawPixbuf( self.Style.BackgroundGC(self.State), self.pb, 0, 0, 0, 0,-1, -1, Gdk.RgbDither.None, 0, 0) def delete_event(self, *args):
       Gtk.Application.Quit()


if __name__ in ['__main__','Program']:
   Gtk.Application.Init()
   mw = MyWindow('Test')
   mw.ShowAll()
   Gtk.Application.Run()

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to