paolo zanone paolo zanone - 11 months ago 99
Python Question

Console in new window

I want the commands that run a python file with console
are in an independent window

my code:

def update(self):
self.prombt("sh /usr/script/")

def prombt(self, com):,_("sTaRt ShElL cOm: %s") % (com), ["%s" % com])

it's possible?



You can realize this using the subprocess module.

import subprocess["gnome-terminal", "-x", "sh", "/usr/script/"])

In this example I used "gnome-terminal" as my terminal emulator. On your system you may not have this emulator and you should replace it with the one you use (e.g. Konsole for KDE). You must then also find the appropriate parameter (in this case "-x") to execute the command, when opening the emulator.