[IronPython] [python] Re: Need a Good Embedded Example
Michael Foord
fuzzyman at voidspace.org.uk
Fri Oct 19 15:00:09 PDT 2007
Joshua J. Pearce wrote:
> What am I doing wrong? I have a form with two text boxes and a button.
> When I type, "tb.clear()" into the first textbox and click the button,
> I get the a MissingMemberException which states, "'TextBox' object has
> no attribute 'clear'".
Do you mean "tb.Clear()" ?
Michael
>
>
> public partial class Form1 : Form
> {
> public static PythonEngine pe = PythonEngine.CurrentEngine;
> public Form1()
> {
> InitializeComponent();
>
> ScriptDomainManager.CurrentManager.Host.DefaultModule.SetVariable("tb",
> textBox2);
> }
>
>
> private void button1_Click(object sender, EventArgs e)
> {
> pe.ExecuteCommand (textBox1.Text);
>
> }
> }
>
>
> Thanks,
>
> Josh Pearce
>
>
> On 10/18/07, *Joshua J. Pearce* < joshua.pearce at gmail.com
> <mailto:joshua.pearce at gmail.com>> wrote:
>
> I am very sorry! I just noticed this:
>
> ScriptDomainManager.CurrentMan
> ager.Host.DefaultModule.SetVariable("SomeName",
> SomeObject);
>
> SomeObject is then available to user code as SomeName...
>
> That is exactly what I want to do!!!
>
> Thank you very much!
>
>
>
> On 10/18/07, *JoeSox* <joesox at gmail.com <mailto:joesox at gmail.com>>
> wrote:
>
> On 10/18/07, Joshua J. Pearce <joshua.pearce at gmail.com
> <mailto:joshua.pearce at gmail.com>> wrote:
> > My application is ASP.NET <http://ASP.NET>, I hardly think
> integrating CPython is going to be a better choice.
>
> You never mentioned you were using ASP.NET <http://ASP.NET>.
> You have mentioned C#.
>
> > Is is possible to 'expose' c# methods that exist in the same
> scope as an IPY
> > engine,
>
> Can you clarify what you mean by this line for me? Can you
> provide a
> C# method that exists in the same scope as an IPY engine?
>
> There must be a custom interface, how would an outside script know
> about a custom method outside it's scope without an custom
> interface?
> Michael and myself have both provided examples.
>
> If you have a C# method it must be represented by something
> else in
> the script or python code that IronPythonEngine is using, then
> update
> the script or python code loaded in the IronPythonEngine using
> the
> examples provided.
>
> Since I have not seen your source, I don't know why you believe
> importing the AppService dll and create your own instance in
> the IP
> engine will be too much overhead. That sounds like the bet
> way to go
> but I am not familiar with your source.
> Good Luck!
> --
> Later, JoeSox
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>
> --
> Joshua Pearce
>
>
>
>
> --
> Joshua Pearce
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
More information about the Users
mailing list