Hi Brandon -- Yeah, this was my fallback. I guess I had eyed the ability to hook in event callbacks because I have other things I'd like to know about such as when a class is declared etc.
Basically, if you have an app where the user is free to code Python script (Execute(code)) -- and I don't want to parse that myself to see what the user is doing, I'd like to get notified somehow when they change a var, or declare a class etc. etc... If I can look at what classes exist pre-execute and what classes exist-post execute, then this would be a possibility, but I haven't really found where that info is as well. I just wasn't sure where I look to see when these things happen. The terminology with Python seems to be quite different then anything I'm used to (I'm a newbie to python) so my search is a bit harder for finding a place to add hooks. And of course, my lack of Python knowledge could just make this a poorly formed solution to begin with. ;-) > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:users- > [EMAIL PROTECTED] On Behalf Of Brandon Furtwangler > Sent: Tuesday, June 20, 2006 11:54 AM > To: 'Discussion of IronPython' > Subject: Re: [IronPython] OnVarChanged > > How fine grain do you need change notifications? you could just store the > pre-execute value of a, and after each python Execute you could check that > the pre-a is the same as a. > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of John Mancine > Sent: Tuesday, June 20, 2006 12:25 PM > To: [email protected] > Subject: [IronPython] OnVarChanged > > I realize this is likely woefully naïve but I thought I'd ask anyhow. > > I have a very specific case in my project where I would really like to > know > when a variable inside IronPython changes. Basically when I do this: > > pythonEngine.Execute("a = 3"); // Or something more complex that ends up > changing global var 'a' > > I am looking for a way to be notified when 'a' has been assigned to a new > value. This seems to be pretty simple for the Set/GetGlobal() calls but > what > about code that is inside of the Execute() block? Where could I look at > adding some code myself such that I can add these hooks? I have dug > through > some of the code to find a place to add a hook but I couldn't seem to find > anything clear cut. > > Again, I realize this is pretty simplistic and also painfully slow for any > moderate scripting but I have a very specific case where I would like some > widgets in C# to respond to when a variable has changed. (The watchwindow > in > visual studio would be a good parallel of what I'm needing to do -- ie. > show > a new value has been set for a particular value you are watching). > > Thanks! > John > > _______________________________________________ > users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
