Can TPad::AddExec call a method in PyROOT?

From: OKUMURA, Akira <oxon_at_mac.com>
Date: Sun, 4 Dec 2011 15:36:25 +0900


Hello ROOTers,

I would like to know if I can call a method of a Python class from TPad::AddExec. How can I do it?

I wrote a Python class which has a TCanvas as a member, and a method which is intended to do some calculations according to the mouse cursor position, as in $ROOTSYS/tutorials/pyroot/DynamicSlice.py

The tutorial uses TPython::Exec, but it is not clear for me to call the class method in the same way.



class MyClass(object):

    def __init__(self):

        self.can = ROOT.TCanvas()
        self.can.AddExec('dynamic', ???) # how to call self.doSomething ?

    def doSomething(self):
        # do something according to the mouse position

Regards,

--
OKUMURA, Akira oxon_at_mac.com, okumura_at_stelab.nagoya-u.ac.jp
Solar-Terrestrial Environment Laboratory, Nagoya University
Furo-cho, Chikusa-ku, Nagoya 464-8601, Japan
TEL: +81 52-789-4320 FAX: +81 52-789-4313
Skype : okumura.akira
Received on Sun Dec 04 2011 - 07:36:37 CET

This archive was generated by hypermail 2.2.0 : Tue Dec 13 2011 - 05:50:01 CET