3D images always flash

You mean they open and immediately disappear? Try running the script via python -i instead of just python, this will prevent the interpreter from quitting once the end of the script has been reached.

You are very right, I have solved this problem. I selected ‘Run with Python Console’ in pycharm to prevent the program from exiting