Article 5BKNG Python Subprocess with Tkinter Problem

Python Subprocess with Tkinter Problem

by
osmantugras
from LinuxQuestions.org on (#5BKNG)
Hi All,
When I am writing the python script on Ubuntu, I have faced the issue that is the screenshot on the attachment. Could you please help me?
:) Regards

#########################################
import tkinter as tk
import subprocess

def Delay(X, Y):
subprocess.run(["tc qdisc add dev", X, "root", "netem delay", Y], shell=True)

return

def ping():

subprocess.run("ping {} -c 2".format(entry1.get()), shell=True)
return

my_gui = tk.Tk()

entry1 = tk.StringVar()
entryI = tk.StringVar()
entryT = tk.StringVar()

my_gui.geometry('500x500')
my_gui.title("Ping Delay")

tk.Label(my_gui, text="Enter target IP or host as required.").pack()
tk.Entry(my_gui, textvariable=entry1).pack()

tk.Label(my_gui, text="Enter target Interface").pack()
entryI = tk.Entry(my_gui, textvariable=entryI).pack()
tk.Label(my_gui, text="Enter Delay Value").pack()
entryT = tk.Entry(my_gui, textvariable=entryT).pack()

tk.Button(my_gui, text="Delay", command=lambda: Delay(entryI, entryT)).pack()
tk.Button(my_gui, text="ping", command=ping).pack()

my_gui.mainloop()
#######################################################
Attached Thumbnailsattachment.php?attachmentid=34847&stc=1& Attached Files
txt.gifPingDelay.txt (868 Bytes)
latest?d=yIl2AUoC8zA latest?i=qAdSuxUcBUA:IR2vQlltlT0:F7zBnMy latest?i=qAdSuxUcBUA:IR2vQlltlT0:V_sGLiP latest?d=qj6IDK7rITs latest?i=qAdSuxUcBUA:IR2vQlltlT0:gIN9vFwqAdSuxUcBUA
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments