Can I Have xlwings Display Console Output?

痴心易碎 提交于 2020-01-06 09:01:46

问题


Is it possible for xlwings to pop up a console while running a script from VBA and show stdout?

I know xlwings writes the stdout to a logfile which is useful, but I'd like to give users some updates while they are waiting for their calculation to finish. The debugger kind of does this but seems like overkill.


回答1:


If you are using UDFs, then there is a simple possibility: By default xlwings uses the pythonw interpreter. Just change it to python and the console window will pop up.

For RunPython you'd need to hack the source code of the addin currently, see here. Basically search for WindowStyle and set it to 1 instead of 0. It should be easy to make this a config at some point.



来源:https://stackoverflow.com/questions/51406629/can-i-have-xlwings-display-console-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!