Re: [Python.NET] Embedding a Python interactive shell in a .NET application

Denis Akhiyarov <[email protected]>
Newsgroups gmane.comp.python.dotnet
Message-ID <CALxxJLRcDdUgt6wpHwCchbP2ehO0HOjqGctYcn0YULt_WbcTUw@mail.gmail.com>
for embedding look at c# embedding unit tests and also here:

1. Old API:

http://pythonnet.github.io/readme.html

2. New simplified API using dynamic:

https://github.com/pythonnet/pythonnet/blob/master/README.md



On Thu, May 12, 2016 at 4:16 PM, Saparya K <[email protected]> wrote:

> Thanks for your response, Denis.
>
> I had not come across Sho earlier. It looks very interesting. (If only
> Python 3.x support was available, though it does look like they have added
> support for their own math and visualization libraries).
>
> I am going over the demos and the unit tests and I was able to write a
> simple console application to access .NET objects from Python. This is very
> encouraging!
> I am still figuring out how to embed Python code in my C# WinForms
> application (instead of a console application).
>
> I will continue my experiments, but in the meantime if you or anyone else
> has any ideas on how to redirect the result from the Python interpreter
> (say, to a rich text box), I would love to hear them. That is one part of
> the puzzle that is unclear to me.
>
> Thanks,
> Saparya
>
> On Wed, May 11, 2016 at 4:01 PM, Denis Akhiyarov <
> [email protected]> wrote:
>
>> This is definitely possible with WinForms or WPF. See the demo folder in
>> pythonnet repo. One of the demo's is still in pull request.
>>
>> You should probably just try running previous IronPython attempts using
>> pythonnet and report issues if any. Have a look at Sho from Microsoft.
>>
>> There is someone trying to embed ipython REPL using pythonnet/Excel-DNA
>> or COM in Excel with Custom Task Pane (CTP) written in WinForms:
>>
>> https://groups.google.com/forum/#!topic/jupyter/CVht4orvQtc
>>
>>
>>
>>
>>
>> On Wed, May 11, 2016 at 4:44 PM, Saparya K <[email protected]> wrote:
>>
>>> Hello PythonNet,
>>>
>>> I am looking to embed a Python interactive (REPL) shell in a .NET
>>> WinForms application.
>>> This C# application displays a graphical visualization of some data.
>>> Methods to manipulate the data in the C# application would be exposed via a
>>> Python API.
>>> The idea is to be able to interact with the data from the Python shell
>>> via the API, and thereby updating the graphical view.
>>>
>>> Ideally, the shell should support any valid Python syntax that is
>>> required to use the API. This would involve:
>>>
>>>    1. Querying a collection of data from the application via the Python
>>>    API
>>>    2. Then manipulating this collection in the Python shell
>>>    3. Making API calls with the modified collection as an argument
>>>
>>> I came across a few examples where an interactive shell was developed
>>> using IronPython. A limitation with this approach is the absence of *Python
>>> 3.x* support (and other C-compiled libraries) in IronPython. For this
>>> reason, I would prefer to use Python.NET if it is possible.
>>>
>>> Has anyone here tried something like this with Python.NET before? Does
>>> it looks like what I am trying to achieve is feasible?
>>>
>>> Any direction would be very helpful!
>>>
>>> _________________________________________________
>>> Python.NET mailing list - [email protected]
>>> https://mail.python.org/mailman/listinfo/pythondotnet
>>>
>>
>>
>> _________________________________________________
>> Python.NET mailing list - [email protected]
>> https://mail.python.org/mailman/listinfo/pythondotnet
>>
>
>
> _________________________________________________
> Python.NET mailing list - [email protected]
> https://mail.python.org/mailman/listinfo/pythondotnet
>

_________________________________________________
Python.NET mailing list - [email protected]
https://mail.python.org/mailman/listinfo/pythondotnet
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.