Hi Chris,
I believe there is an example in the Tutorials section in Iron Python.
Jeff
"Chris Stoy"
<[EMAIL PROTECTED]
orm.com> To
Sent by: <[email protected]>
[EMAIL PROTECTED] cc
ts.ironpython.com
Subject
[IronPython] Accesses static
12/18/2006 05:28 ResourceManager from IronPython
PM
Please respond to
Discussion of
IronPython
<[EMAIL PROTECTED]
python.com>
Hello all,
I’m working on embedding IronPython into a larger C# application to allow
end-users the ability to write scripts. One thing I want to do is provide
a set of icon resources in the C# code and expose them to IronPython so a
user can access them. I created a new Resource.resx file called
“PublicResources” in my C# application. This creates a class called
“PublicResources” that contains a set of static methods to access the
resources in a type-safe way. Although I can expose the underlying
ResourceManager instance to IP, what I really want is the class
PublicResources exposed so I can us it in my IronPython code.
For example, in C# I would say:
Form myForm = new Form();
myForm.Icon = PublicResources.MyFormIcon;
and in IronPython, I want to say:
myForm = Form()
myForm.Icon = PublicResources.MyFormIcon
So, I guess this boils down to “how do I expose static classes from C# to
IronPython?”
(On a side note, if anyone knows where there is some documentation on the
proper way to expose .NET class to IronPython I would appreciate it.
Currently I’m creating a new module with PythonEngine.CreateModule(),
adding objects to the Globals, and importing it using
PythonEngine.Import()…but I have no idea if that is the right way to do
it.)
Thanks a lot for any help.
Chris.
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Although this e-mail and any attachments are believed to be free of any virus
or other defect which might affect any computer system, it is the
responsibility of the recipient to check that it is virus-free and the sender
accepts no responsibility or liability for any loss, injury, damage, cost or
expense arising in any way from receipt or use thereof by the recipient.
The information contained in this electronic mail message is confidential
information and intended only for the use of the individual or entity named
above, and may be privileged. If the reader of this message is not the
intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this transmission in error, please contact the sender
immediately, delete this material from your computer and destroy all related
paper media. Please note that the documents transmitted are not intended to be
binding until a hard copy has been manually signed by all parties.
Thank you.
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com