[Python.NET] Can Python.Net inherit .Net Interface Class

Denis Akhiyarov denis.akhiyarov at gmail.com
Mon Mar 14 19:18:23 EDT 2016


The key is to define namespace, why is also different behavior from
ironpython:

Python 2.7.9 |Continuum Analytics, Inc.| (default, Dec 12 2014, 14:56:54)
[MSC v

.1500 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

Anaconda is brought to you by Continuum Analytics.

Please check out:http://continuum.io/thanks andhttps://binstar.org

>>> import clr

Attempting to load Python.Runtime using standard binding rules...

Attempting to load Python.Runtime from:
'C:\Python\Python27\lib\site-packages\Py

thon.Runtime.dll'...

>>> import System

>>> class ViewModel(System.ComponentModel.INotifyPropertyChanged):

...   __namespace__="blabla"

...   def __init__(self):

...     pass

...

>>> ViewModel()

<__main__.ViewModel object at 0x028784B0>


On Sunday, March 13, 2016, Hansong Huang <hhspiny at pine.cc> wrote:

> I am attempting to implement a MVVM WPF application in Python.Net.
>
> The ViewModel class needs to implement the INotifyPropertyChanged
> interface.
>
> class ViewModel(System.ComponentModel.INotifyPropertyChanged):
>     def __init__(self):
>         pass
>
> vm = ViewModel()
>
> gives exception:
> "TypeError: interface takes exactly one argument"
>
> I am not sure what is the reason.
>
> I remember a post last year saying the the interface inheritance is
> implemented in a development brand and not integrated into main branch. not
> sure if it is the reason.
>
> I am using python 2.1.0.dev1.
>
> thanks
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20160314/57cf3377/attachment.html>


More information about the PythonDotNet mailing list