fork(1) download
  1. import subprocess
  2. import tkinter
  3.  
  4. test_ip = "192.168.0.1"
  5.  
  6. def ping(event=None):
  7. global ping_send
  8. ping_send = subprocess.run("ping -n 3 " + test_ip,stdout=subprocess.PIPE)
  9.  
  10. def ping_results():
  11. print(ping_send.stdout.decode("cp933"))
  12.  
  13. root = tkinter.Tk()
  14. start_ping = tkinter.Button(text="start Ping",command=ping)
  15. start_ping.grid()
  16. show_ping = tkinter.Button(text="show resutls",command=ping_results)
  17. show_ping.grid()
  18. root.bind("<Return>",ping)
  19. root.mainloop()
Runtime error #stdin #stdout #stderr 0.03s 76352KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 13, in <module>
  File "/usr/lib/python3.5/tkinter/__init__.py", line 1880, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable