我可以有xlwings Display Console输出吗? [英] Can I Have xlwings Display Console Output?

查看:97
本文介绍了我可以有xlwings Display Console输出吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

xlwings是否有可能在从VBA运行脚本并显示stdout时弹出控制台?

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

我知道xlwings将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.

推荐答案

如果使用的是UDF,则有一种简单的可能性:默认的xlwings使用 pythonw 解释器。只需将其更改为 python 即可弹出控制台窗口。

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.

对于 RunPython ,您当前需要破解插件的源代码,请参见此处。基本上搜索 WindowStyle 并将其设置为1而不是0。在某个时候使它成为配置应该很容易。

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.

这篇关于我可以有xlwings Display Console输出吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆