[Python.NET] implement the interface of IWin32Window

H.N.(HARRY) ZHANG hnzhang at gmail.com
Thu Jul 31 18:13:50 CEST 2008


by searching pythondotnet mailing-list archive, I just found the following
message,

http://www.mail-archive.com/pythondotnet@python.org/msg00094.html

I think what I mentioned in the email is wrong, and the only solution is
implement the interface in a .NET assembly and expose it to PythonDotNet.

PythonDotNet just works as a BRIDGE, which  gives access to .Net platform.

Thanks,

On Thu, Jul 31, 2008 at 3:00 AM, <pythondotnet-request at python.org> wrote:

> Send PythonDotNet mailing list submissions to
>        pythondotnet at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.python.org/mailman/listinfo/pythondotnet
> or, via email, send a message with subject or body 'help' to
>        pythondotnet-request at python.org
>
> You can reach the person managing the list at
>        pythondotnet-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of PythonDotNet digest..."
>
>
> Today's Topics:
>
>   1. implement System.Windows.Forms.IWin32Window (H.N.(HARRY) ZHANG)
>   2. function assignment (Fulop David)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 23 Jul 2008 13:57:36 -0700
> From: "H.N.(HARRY) ZHANG" <hnzhang at gmail.com>
> Subject: [Python.NET] implement System.Windows.Forms.IWin32Window
> To: pythondotnet at python.org
> Message-ID:
>        <958f31170807231357q489402bfy509e2ef058a5370d at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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...
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/pythondotnet/attachments/20080723/552171ef/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 2
> Date: Thu, 24 Jul 2008 13:09:01 +0200
> From: "Fulop David" <fulopd at 5ncomp.hu>
> Subject: [Python.NET] function assignment
> To: pythondotnet at python.org
> Message-ID: <20080724105252.M91781 at 5ncomp.hu>
> Content-Type: text/plain;       charset=iso-8859-2
>
> Hello
>
> I am new in python, so I don't know, what has to be worked, and what is
> under
> development.
>
> But I have a problem:
> If use python for .net 2.0 alpha 2 and matplotlib
> If I run python2.4-UCS2\python.exe and I type the following code, it is
> working. (this is not the problem :) )
>
> import pylab as p
> def onclick(event):
>  print 'clicked'
> fig=p.figure()
> ax = fig.add_subplot(111)
> ax.plot(t1, s1, linewidth=1.0)
>
> fig.canvas.mpl_connect('button_press_event',cl)
> p.show()
>
> But if I want to run the following script with ironpython 2B3 it did not
> work.
>
> from embedding import Import
> pyl=Import('pylab')
> fig = pyl.plt.figure()
>
> def onclick(event):
>  print 'clicked'
>
> cid = fig.canvas.mpl_connect('button_press_event', onclick)
> pyl.show()
>
> I used python2.4-UCS2 dll and a necessary embedding.py.
>
> The problem with the onclick object.
> Why does it work only in the first case?
>
> The main reason for i am interested in is that I want to host ironpython in
> c# and I want use matplotlib in ironpython.
>
> The bests
> David Fulop
>
>
>
> ------------------------------
>
> _______________________________________________
> PythonDotNet mailing list
> PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet
>
>
> End of PythonDotNet Digest, Vol 56, Issue 5
> *******************************************
>



-- 
--------------------
H.N.(HARRY) ZHANG
hnzhang at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20080731/5818d0a7/attachment.htm>


More information about the PythonDotNet mailing list