简体   繁体   English

ipython magic函数的内存地址

[英]Memory address of ipython magic functions

I have been experimenting with the scriptable visualization tool mayavi from ipython's terminal. 我一直在尝试使用ipython终端的可脚本化可视化工具mayavi 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): Mayavi使用wx后端,因此我调用magic函数只是为了检查地址,然后更改gui并再次检查地址以确保更改已生效(尽管我知道这没什么用):

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 ? 问题为什么3和4中的地址不同?

From the docs: 从文档:

For users, enabling GUI event loop integration is simple. 对于用户而言,启用GUI事件循环集成非常简单。 You simple use the %gui magic as follows: 您可以简单地使用%gui魔术,如下所示:

%gui [GUINAME] %gui [GUINAME]

With no arguments, %gui removes all GUI support. 不带任何参数的%gui将删除所有GUI支持。

Valid GUINAME arguments are wx, qt, gtk and tk. 有效的GUINAME参数是wx,qt,gtk和tk。

Thus, to use wxPython interactively and create a running wx.App object, do: %gui wx 因此,要交互使用wxPython并创建一个正在运行的wx.App对象,请执行以下操作:%gui wx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM