I'm trying to implement the interface of IWin32Window, so that when the UI
from PythonDotNet is created, I can set the owner.

Here is the code,

class WindowWrapper(System.Windows.Forms.IWin32Window):
    def __init__(self, handle):
        self._hwnd = handle

    def Handle():
        doc = "property foo's doc string"
        def fget(self):
            return self._hwnd
        return locals()
    Handle = property(**Handle())

However, when an instance of WindowWrapper gets created, I got the following
error---# TypeError: object does not implement IWin32Window #

Here is the code to create an instance of WindowWrapper
        procs = System.Diagnostics.Process.GetProcessesByName("maya");
        intPtr = procs[0].MainWindowHandle
        self.winWrapper = WindowWrapper(intPtr)

It seems I am doing something wrong in class WindowWrapper...
_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
http://mail.python.org/mailman/listinfo/pythondotnet

Reply via email to