Example of subprocess output shown in text box of tkinter GUI in python language
from tkinter import *
import subprocess
import os
from tkinter import *
from subprocess import Popen, PIPE
root = Tk()
text = Text(root)
v_complete="EXPDP hjr/hr@pdb1 Directory=dbbackup REUSE_DUMPFILES=Y schemas=hr dumpfile=dbbackuphr.dmp logfile=hr.log"
#p1 = subprocess.run(v_complete ,stdout=subprocess.PIPE, text = True)
def ls_proc():
return Popen(v_complete,shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE,universal_newlines=True)
with ls_proc() as p:
if p.stdout:
for line in p.stdout:
text.insert(END, line)
if p.stderr:
for line in p.stderr:
text.insert(END, line)
#text.insert(INSERT, p1.stdout)
#text.insert(END, "hello")
text.pack()
root.mainloop()
Like this:
Like Loading...
Related