1

I have been experimenting with the scriptable visualization tool mayavi from ipython's terminal. Mayavi uses the wx backend, and therefore I call the magic function just to check the address, then change the gui and check again the address to make sure the change has taken effect (although I know it's a bit useless):

In [1]: %gui
Out[1]: <CFunctionType object at 0x03491D50>

In [2]: %gui wx
Out[2]: <wx._core.App; proxy of <Swig Object of type 'wxPyApp *' at 0x33a8ea8> >

In [3]: %gui
Out[3]: <CFunctionType object at 0x0354AEB8>

In [4]: %gui
Out[4]: <CFunctionType object at 0x0354AF30>

The question why are the addresses in 3 and 4 different ?

SAAD
  • 759
  • 1
  • 9
  • 23
  • You are not specifying `%gui wx` in 3 and 4 so it makes sense that it is changing, you are creating a new object each call. – Padraic Cunningham Sep 07 '14 at 23:26
  • I am calling the function to check if the address has changed after setting the `wx`option, and after this I assume that the address will be the same, unless I change the backend again. – SAAD Sep 07 '14 at 23:28
  • My question in other words is "why would the address change if I am not changing anything in the behavior of the magic function?" – SAAD Sep 07 '14 at 23:29
  • 1
    No, calling with no arguments removes all GUI support. You are not checking the address of the same object like you were using `%gui wx`, that will return the same object each time – Padraic Cunningham Sep 07 '14 at 23:29
  • Ok I didnt know that. You could post the answer by the way – SAAD Sep 07 '14 at 23:30
  • Ok, I will add the documentation. – Padraic Cunningham Sep 07 '14 at 23:31
  • BTW with recent versions of Mayavi, you are likely to have better performance and robustness with Qt/PySide backend than with wx. – Jonathan March Sep 08 '14 at 01:32

1 Answers1

0

From the docs:

For users, enabling GUI event loop integration is simple. You simple use the %gui magic as follows:

%gui [GUINAME]

With no arguments, %gui removes all GUI support.

Valid GUINAME arguments are wx, qt, gtk and tk.

Thus, to use wxPython interactively and create a running wx.App object, do: %gui wx

Padraic Cunningham
  • 176,452
  • 29
  • 245
  • 321