问题
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