How to pass calculated data to my own Python shell namespace at runtime ?

In my main frame, I have a tab , in the tab I have shell running:

        self.qmeshell = py.shell.Shell(self.nbls, -1, introText="Qme-PythonShell ")
        self.nbls.AddPage(self.qmeshell,"Qme-Python Shell")
       
All is ok BUT

in some part of the program I calculate some matrix and I want to have access to this matrix in the shell.

How to pass my matrix say 'matx' into the namespace of the shell running in mind so that I can access my 'matx' from the shell ?

Then can I read from my shell namespace and get 'matx' back after I played with it in the shell ? This inorder to send it back to my program ?

Any idea is welcome.

Best Regards

Robert

The Shell ctor takes a "locals" keyword argument, which is a
dictionary to use to as the namespace of the shell - modifications to
it will be visible from both "sides". One thing to be aware of is that
__builtins__ will be added to it.

···

On 1/11/07, Robert F. VERGNES <rfv@lit-energy.com> wrote:

In my main frame, I have a tab , in the tab I have shell running:

        self.qmeshell = py.shell.Shell(self.nbls, -1,
introText="Qme-PythonShell ")
        self.nbls.AddPage(self.qmeshell,"Qme-Python Shell")

All is ok BUT

in some part of the program I calculate some matrix and I want to have
access to this matrix in the shell.

How to pass my matrix say 'matx' into the namespace of the shell running
in mind so that I can access my 'matx' from the shell ?

Then can I read from my shell namespace and get 'matx' back after I
played with it in the shell ? This inorder to send it back to my program ?

Any idea is welcome.

Best Regards

Robert