0

我正在用 python 构建一个桌面应用程序,我想包括一个用户可以编写和运行 python 代码的部分。

4

1 回答 1

0

您可以使用 python 脚本使用这样的代码从 python 脚本中打开 python idle。

# importing the module
import os
  
# setting the path of the IDE
# use of \\ is important because 
# \ will be treated as a escape sequence
# here we are using the Python Idle 
# path to open the Python idle
path="C:\\Program Files (x86)\\Python\\python3.7.exe"
  
# using the os.startfile() method
os.startfile(path)

为了将空闲添加到您的应用程序,您可以调整窗口大小并将其放置在您的应用程序中。

于 2021-06-21T17:06:51.450 回答