Re: [IronPython] IP 2.7b1 - Accessing C# variables from Python
Hello, Here is a simple way to call into C# variables from IronPython using a scope. var engine = IronPython.Hosting.Python.CreateEngine(); var scope = engine.CreateScope(); var dict = new Dictionarystring, string(); dict[key] = value; scope.SetVariable(hash, dict); // Calling dict from IP engine.Execute(print hash['key'], scope); Pascal -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Ron Lindsey Sent: January-05-11 2:25 PM To: Daniel Jennings Cc: Discussion of IronPython Subject: Re: [IronPython] IP 2.7b1 - Accessing C# variables from Python Daniel, Thanks for the reply. To your question, No. The real problem here is how do i get access to the variables in c# from ironpython. Thanks, Ron Lindsey On 1/5/2011 1:22 PM, Daniel Jennings wrote: Have you tried just treating it like a regular Python dictionary? I thought that's all I had to do, though I work with DictionaryK,V, not Hashtable objects. -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Ron Lindsey Sent: Wednesday, January 05, 2011 11:21 AM To: users@lists.ironpython.com Subject: [IronPython] IP 2.7b1 - Accessing C# variables from Python I have written an OpenGL 3D modeling program in C#/OpenTK. In the program, I store all the objects (box, sphere, tube, etc) the user created into a hashtable. Each object stored is of type Box, Sphere etc... I am embedding IronPython to give the user a way to animate their models. So in IronPython, the user needs to have access to the objects in the hashtable to get/set properties of the different objects. Once the script is written, they then will run it. as the script executes, it will control the objects in the hashtable, which in turn will move the 3D models in the screen. I have looked/googled/read but have not found out a way to access a C# hashtable and the objects stored with in it. Any ideas? ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] SciPy
Hello, Just to add to Oleksii’s comment, I’m also in a similar situation where I’d like to make an application scriptable with any of my good Iron language friend. I have been using IronPython and IronRuby for side projects for quite some time but not embedded in an application distributed to users. I will probably be embedding both languages but at some point I will need choose one for my users as I will need to create some helpers. I’m still hesitating between both languages so I’d like to know what others think about this. * I prefer the expressiveness of Ruby but I think Python me be easier to learn (for a non programmer technical person) * IronPython seems to perform much better than IronRuby but performance is not an issue in my case (compared to numerical computation) * Since the Iron languages have been released to the community I’m afraid they will not be equally supported or even stop to evolve and support new .net features. It seems to me that the IronPython community is bigger, so it might have a greater chance to survive or be able to continue evolve. Thanks; Pascal From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Oleksii Bidiuk Sent: December-20-10 4:05 PM To: Discussion of IronPython Subject: Re: [IronPython] SciPy Hi All, I am not intended to add oil to the fire, but I am curious whether somebody can comment on the statement of Mark Our company uses C#. I quickly discovered that C# and Python don’t play well together …. I have a similar situation, meaning C# application that needs to be a) scriptable b) usable for image/data processing using e.g. NumPy and SciPy. While IronPython seems to be the 'easy bet', I wonder if it is also a 'safe bet' for the long term future and whether there are tangible alternatives like e.g. PythonNET (I hope there are others, preferrably backed up by some heavyweight/commercial players). Can anyone comment on this one? Anybody is using or going to use IronPython in commercial apps? Thanks in advance. -- Oleksii ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com