[Ironpython-users] ResourceManagement
Matt Ward
ward.matt at gmail.com
Thu May 30 21:37:53 CEST 2013
Hi Jason,
Take a look at this post about SharpDevelop, IronPython and form resources
which goes into more detail than I will cover here.
http://community.sharpdevelop.net/blogs/mattward/archive/2009/09/28/IronPythonFormResources.aspx
The basic problem is that the forms designer in SharpDevelop generates code
that assumes you will be compiling your application to an executable so the
resources for the form are compiled into that executable. The image for the
toolstrip button will be part of a .resx file in your project and on
compilation will be embedded into your exe.
PTVS will run your IronPython application with ipy.exe and will not compile
it to an executable, instead running your main IronPython file directly, so
you are going to have to load the resources in a different way, such as
loading them directly from a file or an assembly.
Regards,
Matt
On 30 May 2013 17:48, Jason Barner <necroak at hotmail.com> wrote:
> Hello, I have recently stumbled upon IronPython, and have taken quite an
> interest in getting to know the workings of it. I've got experience with
> C#, and many other languages so I am quite comfortable with most of the
> underlying principles of how things work.
>
> I've been tinkering with simple WinForms apps, and have come upon a bit of
> a snag. In normal C#, (with design view) you can simply drag and drop a
> toolstrip, insert the "standard" items to it, and it ever so nicely
> generates a bunch of code for you.
>
> While I have certainly informed myself through Google that PTVS just
> doesn't support the WYSIWYG designer for WinForms (I see it does for WPF) I
> haven't let it deter me from fiddling around. I also noticed that
> SharpDevelop does support the designer for WinForms with python, and can
> handle the toolstrip issues I am facing now, but I would rather understand
> the issue I am having rather then just using a tool/designer to spew code
> out for me...
>
> I've got a few IronPython books, of which I believe only one touches on
> the issue I have, but I just can't get a good understanding from how they
> present it...so hopefully one of you fine people can help me out =)
>
>
> My problem :
>
> *In SharpDevelop, when using the standard items on the toolstrip, you are
> generated this :*
> resources = System.Resources.ResourceManager("Test.MainForm"
> , System.Reflection.Assembly.GetEntryAssembly())
>
> *Which allows this to be done : *
>
> self._newToolStripButton.Image = resources.GetObject(
> "newToolStripButton.Image")
>
>
> *In C#, when doing the same you are generated this : *
> System.ComponentModel.ComponentResourceManager resources = new
> System.ComponentModel.ComponentResourceManager(typeof(Form1));
>
> *Which allows this :*
>
> this.newToolStripButton.Image =
> ((System.Drawing.Image)(resources.GetObject("newToolStripButton.Image")));
>
>
> These images are provided with visual studios as far as I am aware, but I
> am just not sure how exactly they are found, and more specifically I cannot
> get an implementation like this to work with normal IronPython and PTVS.
>
>
> If anyone has any knowledge on how I can implement this with IronPython
> with the PTVS setup, I would love to know how it can be done..it would also
> be highly appreciated to know what exactly the difference is, and some of
> (if not all) of what exactly is being done for the images to be pulled...
>
> Thanks for your time!
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20130530/a1af2529/attachment.html>
More information about the Ironpython-users
mailing list