[IronPython] changing c# var values in IP
Kevin Gadd
kevin.gadd at gmail.com
Mon Oct 9 20:40:10 CEST 2006
I suggest making the following changes:
Make idL a public member
Place frmStart in a variable instead of idL itself (I am pretty sure
setvariable isn't making a reference to your variable, just to the value of
it)
So something like
...
public string idL;
...
engine.SetVariable("frm", this);
...
frm.idL = "Hello World!"
On 10/6/06, ANNA CHAPOVALOV <anfaleo at gmail.com> wrote:
>
> Hi all,
> I'm a newbee in IP, so sorry if i ask (maybe) dumb questions....
>
> I'm using IP for scripting in a c# app. I have something like this:
>
> public partial class frmStart : Form
> {
>
> string idL;
> ......
> ......
> private void frmStartBatch_Load(object sender, EventArgs e)
> {
> idL = "";
> engine = new PythonEngine();
>
> engine.ImportSite();
> engine.SetVariable("idL", idL );
> engine.ExecuteFile("ip.py");
> //At this point i would aspect that idL has the value passed in
> ip.py scrypt.. but it still has ""...
> }
> }
>
> Here's my ip code:
>
> idL = "Hello World!"
>
> Is it ok? How come? I've found some workarounds... but still curious why
> it happens.
>
> Other thing i've noticed is that if i have a class (i've tried with a form
> class), if i pass it (this) as variable to a ip script, not all it's widgets
> and attrs are avaible... is this linked with the .NET attributes issues?
>
> thanks!!
>
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20061009/47517c5d/attachment.html>
More information about the Ironpython-users
mailing list