from Tkinter import * import socket import thread class ChatClient(Frame): def __init__(self, root): Frame.__init__(self, root) self.root = root self.initUI() self.serverSoc = None self.serverStatus = 0 self.buffsize = 1024 self.allClients = {} self.counter = 0 def initUI(self): self.root.title("IGMP test tool") ScreenSizeX = self.root.winfo_screenwidth() ScreenSizeY = self.root.winfo_screenheight() self.FrameSizeX = 800 self.FrameSizeY = 600 FramePosX = (ScreenSizeX - self.FrameSizeX)/2 FramePosY = (ScreenSizeY - self.FrameSizeY)/2 self.root.geometry("%sx%s+%s+%s" % (self.FrameSizeX,self.FrameSizeY,FramePosX,FramePosY)) self.root.resizable(width=True, height=True) padX = 10 padY = 10 parentFrame = Frame(self.root) parentFrame.grid(padx=padX, pady=padY, stick=E+W+N+S) testCase= Frame(parentFrame) choiceLabel = Label(testCase,text="Make your choice") self.optionTest = IntVar() self.optionTest.set(1) snoopingRadio = Radiobutton(testCase,variable=self.optionTest,text="IGMP snooping",indicatoron = 1,value = 1) proxyRadio = Radiobutton(testCase,variable=self.optionTest,text="IGMP proxy",indicatoron = 1,value = 2) snoopingCase1 = Checkbutton(testCase,text = 'case1',command = self.callCase1) snoopingCase2 = Checkbutton(testCase,text = 'case2',command = self.callCase2) snoopingCase3 = Checkbutton(testCase,text = 'case3',command = self.callCase3) snoopingCase4 = Checkbutton(testCase,text = 'case4',command = self.callCase4) proxyCase1 = Checkbutton(testCase,text = 'case1',command = self.callCase1) proxyCase2 = Checkbutton(testCase,text = 'case2',command = self.callCase2) proxyCase3 = Checkbutton(testCase,text = 'case3',command = self.callCase3) proxyCase4 = Checkbutton(testCase,text = 'case4',command = self.callCase4) start = Button(testCase, text="start", command = self.startTest, width=10, height=1) stop = Button(testCase, text="stop", command = self.stopTest, width=10, height=1) level = StringVar() level.set('warn') bugLevel = OptionMenu(testCase, level, 'Debug', 'Info', 'Warn', 'Error', 'Fatal' ) bugLabel =Label(testCase, text ="bug level") choiceLabel.grid(row=0, column=0, stick=W) snoopingRadio.grid(row=1, column=0, stick=W) snoopingCase1.grid(row=2, column=0) snoopingCase2.grid(row=3, column=0) snoopingCase3.grid(row=4, column=0) snoopingCase4.grid(row=5, column=0) proxyRadio.grid(row=6, column=0, stick=W) proxyCase1.grid(row=7, column=0) proxyCase2.grid(row=8, column=0) proxyCase3.grid(row=9, column=0) proxyCase4.grid(row=10, column=0) start.grid(row=11, column=0, sticky=W+N, pady =30) stop.grid(row=11, column=1, sticky=W+N, padx =10, pady =30) bugLabel.grid(row=12, column=0, sticky=W+N+S) bugLevel.grid(row=12, column=1, sticky=W+N+E+S) testResult = Frame(parentFrame) self.result = Listbox(testResult, bg="white", width=70, height=30) self.result.grid(row=0, column=0, sticky=E+N+S) # controlTest = Frame(parentFrame) testCase.grid(row=0, column=0, stick=N) #controlTest.grid(row=1, column=0, stick=N) testResult.grid(row=0, column=1,padx =40) # parentFrame.rowconfigure(0,weight=1000) def callCase1(self): print"callCase1" def callCase2(self): print"callCase2" def callCase3(self): print"callCase3" def callCase4(self): print"callCase4" def startTest(self): print"callCase3" def stopTest(self): print"callCase4" def main(): root = Tk() app = ChatClient(root) root.mainloop() if __name__ == '__main__': main()
http://blog.chinaunix.net/uid/199788.html
posted on
浙公网安备 33010602011771号