python gui调用程序
时间: 2023-05-25 15:05:33 浏览: 185
在Python中,可以使用多个GUI库创建GUI应用程序,包括TKinter、PyQt、wxPython等。
以TKinter为例,以下是一个简单的调用程序的示例:
```python
import tkinter as tk
import os
def open_file():
os.system('notepad.exe')
root = tk.Tk()
root.geometry('300x100')
root.title('调用程序')
button = tk.Button(root, text='打开记事本', command=open_file)
button.pack(pady=20)
root.mainloop()
```
以上代码创建了一个窗口,其中有一个按钮“打开记事本”,点击按钮后就可以调用系统的记事本程序打开一个新的窗口。
在函数`open_file()`中使用了`os.system()`函数,它可以在控制台执行指定的命令。在这个例子中,使用命令`notepad.exe`打开系统中的记事本程序。可以根据实际需求替换成其它可执行程序的路径。
阅读全文
相关推荐















