目的:实现ping的GUI界面
语言:python 工具:pycharm
一、安装pycharm
二、实现
from tkinter import *
import os
test = Tk()
test.title('ping')
test.geometry("500x400")
t = Text()
t.pack()
frm = Frame(test)
frm_L = Frame(frm)
var = Variable()
e = Entry(frm_L, textvariable=var)
var.set("www.baidu.com")
e.pack()
frm_L.pack(side=LEFT)
frm_R = Frame(frm)
def testping():
content="ping %s" % var.get()
t.insert(END,os.popen(content).read(),'/n')
Button(frm_R, text="开始", command = testping).pack()
frm_R.pack(side=RIGHT)
frm.pack()
test.mainloop()