按下按钮时运行Powershell脚本

时间:2020-09-20 15:41:54

标签: python python-3.x powershell tkinter

我在Python中有一个非常简单的UI,我想在按下按钮时运行Powershell脚本。问题在于,脚本运行时没有按下按钮。

这是两个相关的功能:

{{1}}

顺便说一句:我正在使用Tkinter作为GUI框架

1 个答案:

答案 0 :(得分:2)

问题在这里

self.setup = tk.Button(self, text="Bot Setup", command=self.powershell_setup())

它必须是(command必须是可调用对象):

self.setup = tk.Button(self, text="Bot Setup", command=self.powershell_setup)