<div dir="ltr">Have you tried @clrmethod decorator?<div><br></div><div><a href="https://github.com/pythonnet/pythonnet/blob/master/src/runtime/resources/clr.py#L54">https://github.com/pythonnet/pythonnet/blob/master/src/runtime/resources/clr.py#L54</a><br></div><div><a href="https://github.com/pythonnet/pythonnet/blob/master/src/tests/test_clrmethod.py#L14">https://github.com/pythonnet/pythonnet/blob/master/src/tests/test_clrmethod.py#L14</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 19, 2018 at 10:37 AM, WARD Steve <span dir="ltr"><<a href="mailto:Steve.Ward@oxinst.com" target="_blank">Steve.Ward@oxinst.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple">
<div class="m_5315680453192128789WordSection1">
<p class="MsoNormal">Can anyone tell me how to cast or Convert (or use a TryGet, or As whatever…), a PyObject (a Python function), to a C# RoutedEventHandler?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The Python function:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">def</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> OnStartButton(</span><span style="font-size:9.5pt;font-family:Consolas;color:gray">sender</span><span style="font-size:9.5pt;font-family:Consolas;color:black">,</span><span style="font-size:9.5pt;font-family:Consolas;color:gray">args</span><span style="font-size:9.5pt;font-family:Consolas;color:black">):<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:green">#do stuff</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">pass</span> <u></u>
<u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks<u></u><u></u></p>
<p class="MsoNormal">Steve<u></u><u></u></p>
</div>
______________________________<wbr>______________________________<wbr>_______________<br>
This e-mail is confidential and is for the addressee only. Please refer to <br>
<a href="http://www.oxinst.com/email-statement" target="_blank">www.oxinst.com/email-statement</a> for regulatory information.
</div>
<br>______________________________<wbr>___________________<br>
Python.NET mailing list - <a href="mailto:PythonDotNet@python.org">PythonDotNet@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/pythondotnet" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/pythondotnet</a><br>
<br></blockquote></div><br></div>