You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, I found relatively few discussion and solution. Forgive me raise the issue here. :)
I am not sure if this is an intent for pythonnet not to support. If so, reasons are welcomed.
Otherwise, I find the practice (implementing an interface) is common, and so why there is no support.
My use case is, I am given a dll. The interface is defined there. I want to develop Python class that implements the interface. Without this approach viable, I foresee my developed application would then be half in C# and half in Python, which I consider ugly.
The documentation is seriously incomplete in this area. All it currently says about Python subclasses of .NET base classes is here:
Managed classes can also be subclassed in Python, though members of the Python subclass are not visible to .NET code. See the helloform.py file in the /demo directory of the distribution for a simple Windows Forms example that demonstrates subclassing a managed class.
Since methods are "members", this made me think that overriding methods was not possible. And the linked example did nothing to correct that misunderstanding.
Activity
den-run-ai commentedon May 21, 2018
@willhyper is this something what you are looking for? scroll to the end of the issue with comments how this was implemented in pywebview:
#567
willhyper commentedon May 24, 2018
@denfromufa Awesome! namespace is the missing single line that solves my question!
den-run-ai commentedon May 24, 2018
great, then let's close this issue. feel free to comment back.
mkimberling commentedon Apr 21, 2020
I was recently confused by this and had to do alot of googling to find the answer on Stack Overflow.
It would be a great improvement to have
mhsmith commentedon Jul 11, 2023
The documentation is seriously incomplete in this area. All it currently says about Python subclasses of .NET base classes is here:
Since methods are "members", this made me think that overriding methods was not possible. And the linked example did nothing to correct that misunderstanding.
Perhaps it would be better to link to these tests, which inherit from these C# base classes.