是否可以在Python中从Powershell打印代码。我目前拥有的代码只是将结果打印到Python终端中,而不是GUI中。如何将其打印到Tkinter GUI中?
Powershell代码:
Write-Output "[BIOS:config:Network:MACAdressPassThr]$status_mac"
Python代码:
def biossettings():
p = subprocess.Popen(["powershell.exe", "C:\\Users\\zra01\\PycharmProjects\\py\\src"
"\\center\\bios_settings.ps1"], stdout=sys.stdout)
p.communicate()
labelbios = Label(root, text=str(biossettings()))
p = repr(subprocess.Popen(["powershell.exe", "C:\\Users\\zra01\\PycharmProjects\\py\\src"
"\\center\\bios_settings.ps1"],
stdout=subprocess.PIPE).communicate()[0])
labelbios = Label(root, text=p)