2016-03-27 51 views
0

我可以从subprocess运行多个应用程序,如文字处理程序吗?使用子流程模块打开多个应用程序

import subprocess 

self.commandLinkButton_2.clicked.connect(self.pycharm) 

self.commandLinkButton_6.clicked.connect(self.terminal) 

def pycharm(self): 
    subprocess.call(['/usr/bin/pycharm']) 

def terminal(self): 
    subprocess.call(['/usr/bin/terminal']) 

回答

0

是的。您需要改为使用subprocess.Popen,并通过将其设置为None来关闭stdin,stdoutstderr。试试这些:

def pycharm(self): 
    subprocess.Popen(['/usr/bin/pycharm'], stdin=None, stdout=None, stderr=None) 

def terminal(self): 
    subprocess.Popen(['/usr/bin/terminal'], stdin=None, stdout=None, stderr=None)