从 Python IDLE 控制 Paraview GUI [英] Controlling Paraview GUI from Python IDLE
问题描述
我正在尝试使用 IDLE 以交互方式控制 Paraview.这将涉及从 IDLE 发送命令并查看 Paraview 中发生的更改.我宁愿不使用in-Paraview python shell.
到目前为止,我已经成功地从 IDLE 导入了 Paraview 模块(simple、servermanager...等).但是发送的命令不会反映在 Paraview 中.例如:
<预><代码>>>>从 paraview.simple import *>>>锥=锥()>>>表演()>>>使成为()确实创建了一个锥体.然而,锥体输出到一个新的、独立的 OpenGL 窗口,而不是 Paraview GUI.
是否可以使用 IDLE 以交互方式控制 Paraview?如果是这样如何做到这一点?谢谢
您需要在多客户端/服务器模式下运行 paraview.在终端中运行 pvserver.
./bin/pvserver --multi-clients
在另一个终端中,运行 paraview 并连接到您的服务器
./bin/paraview文件->连接添加服务器 ->选择一个名字 ->配置 ->保存连接
在第三个终端中,运行 pvpython(或您自己配置的 python)
./bin/pvpython>>从 paraview.simple import *>>连接(本地主机")>>锥体()>>表演()
I am trying to control Paraview interactively using IDLE. This would involve sending commands from IDLE and seeing the changes occur in Paraview. I would rather not use the in-Paraview python shell.
So far, I have succeeded in importing the Paraview modules (simple, servermanager…etc) from IDLE. However the commands sent do not reflect in Paraview. For instance:
>>> from paraview.simple import *
>>> cone = Cone()
>>> Show()
>>> Render()
does indeed create a cone. However the cone is output to a new, independent OpenGL window, and not the Paraview GUI.
Is it possible to control Paraview interactively using IDLE? If so how to accomplish this? Thanks
You need to run paraview in multiclient/server mode. In a terminal run pvserver.
./bin/pvserver --multi-clients
In another terminal, run paraview and connect to your server
./bin/paraview
File->Connect
AddServer -> Choose a name -> Configure -> Save
Connect
In a third terminal, run pvpython (or your own configured python)
./bin/pvpython
>> from paraview.simple import *
>> Connect("localhost")
>> Cone()
>> Show()
这篇关于从 Python IDLE 控制 Paraview GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!