python 2.7 - tkinter button to open new window and run script -


i have tkinter button want use run existing python script in new cmd window. how that? can new cmd window appear, how run script in it?

thanks, chris.

multiline code more readable if edit question add (allowed, mark edited , in comment) rather in comment.

from tkinter import * sys import executable subprocess import popen, create_new_console import os def delprof(): popen(["cmd.exe"], creationflags=create_new_console) `  

if console prompt, can run python or else. run particular python program, following works me (3.4).

from tkinter import * subprocess import call  pyprog = 'tem2.py' def callpy(): call(['python', '-i', pyprog] )  root = tk() button(root, text='run', command=callpy).pack() root.mainloop() 

when running program, console disappears when program ends. prevent python program, output can seen, either put like

input('hit enter exit') 

at end of program or start '-i', did above. allows execution of additional interactive statements examine result


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -