Writing down the python View Interface to manage nginx in idle time is not good enough, but I hope to help other kids shoes. I again lamented that the powerful python is not enough to talk about the code. [Root @ localhost ~] # Cat/opt/python. py #-*-encoding = UTF-8-*-import Tkinter from Tkinter import * from FileDialog import * import OS root = Tk () root. title ('nginx management gui') root. geometry ('800x400') t = Tkinter. text (root, height = 20, width = 100, bg = 'Gray ', wrap = 'word') def openfile (): t. delete (1.0, 'end') fd = LoadFileDialog (root) filename = fd. go () content = open (filename, 'R') lines = content. readlines () for line in lines: t. insert ('end', line) # file. close () def savefile (): fd = SaveFileDialog (root) filename = fd. go () file = open (filename, 'w') content = t. get (1.0, END) file. write (content) file. close () def threads (): t. delete (1.0, 'end') result = OS. popen ('ps-ef | grep httpd | grep-v grep | wc-l '). readlines () t. insert (INSERT, "\ n ". join (result), "a") def status (): t. delete (1.0, 'end') result = OS. popen ('sh status. sh '). readlines () t. insert (INSERT, "\ n ". join (result), "a") def total (): t. delete (1.0, 'end') result = OS. popen ('sh conn. sh '). readlines () t. insert (INSERT, "\ n ". join (result), "a") def start (): t. delete (1.0, 'end') result = OS. popen ('service httpd start '). readlines () t. insert (INSERT, "\ n ". join (result), "a") def stop (): t. delete (1.0, 'end') result = OS. popen ('service httpd stop '). readlines () t. insert (INSERT, "\ n ". join (result), "a") def restart (): t. delete (1.0, 'end') www.2cto.com result = OS. popen ('service httpd restart '). readlines () t. insert (INSERT, "\ n ". join (result), "a") def about (): t. delete (1.0, 'end') w = Label (root, text = "This is the first version of nginx management. Thank you for your support.") w. pack (side = TOP) menubar = Menu (root) # create a drop-down Menu File and add it to the TOP Menu bar filemenu = Menu (menubar, tearoff = 0) filemenu. add_command (label = "Open configuration file", command = openfile) filemenu. add_command (label = "Save configuration file", command = savefile) filemenu. add_separator () filemenu. add_command (label = "quit", command = root. quit) menubar. add_cascade (label = "nginx Configuration Management", menu = filemenu) # create a drop-down Menu: Edit editmenu = menu (menubar, tearoff = 0) editmenu. add_command (label = "Total number of threads", command = threads) editmenu. add_command (label = "status", command = status) editmenu. add_command (label = "Connections", command = total) menubar. add_cascade (label = "nginx basic monitoring View", menu = editmenu) # create the drop-down Menu status editmenu = menu (menubar, tearoff = 0) editmenu. add_command (label = "start nginx", command = start) editmenu. add_command (label = "stop nginx", command = stop) editmenu. add_command (label = "restart nginx", command = restart) menubar. add_cascade (label = "nginx operation", menu = editmenu) # create a drop-down Menu Help helpmenu = menu (menubar, tearoff = 0) helpmenu. add_command (label = "about", command = about) menubar. add_cascade (label = "view version and help", menu = helpmenu) # display menu root. config (menu = menubar) # display menu t. pack () mainloop () Note that the module required here also has the system execution result in the graphic interface: The following are other functions to view