#/usr/bin/python #encoding=utf-8 import os import Tkinter import tkMessageBox def handleListboxClicked(event, listBox): tkMessageBox._show('current select', listBox.get(listBox.curselection())) def clickedListbox(handler, **kwds): return lambda event, fun = handleListboxClicked, kwds = kwds : fun(handleListboxClicked, **kwds) def startBtnClicked(eidText, regionText): root.geometry('600x350') fileList = Tkinter.Listbox(root) fileList.place(height = 190, width = 580, x = 10, y = 150) fileList.bind('<Double-Button-1>', clickedListbox(handleListboxClicked, listBox = fileList)) logText = Tkinter.Listbox(root) logText.place(height = 120, width = 240, x = 350, y = 20) logText.insert(Tkinter.END, 'select ' + eidText + regionText) logText.insert(Tkinter.END, 'get file from ftp server ' + '192.168.1.101') logText.bind('<Double-Button-1>', clickedListbox(handleListboxClicked, listBox = logText)) findLocalExe(fileList, eidText, regionText) pass def findLocalExe(list, eid, region, rootdir = '/home/zhangqi/CodeFile/'): #print(eid, region) index = 0 for parent, dirnames, filenames in os.walk(rootdir): for dirname in dirnames: print "dirname is" + dirname for filename in filenames: print "parent is:" + parent #print "filename is:" + filename #print "the full name of the file is:" + os.path.join(parent,filename) list.insert(Tkinter.END, os.path.join(parent,filename)) pass root = Tkinter.Tk() if '__main__' == __name__: root.geometry('400x150') root.title('ConsoleFW') #root.iconbitmap('/home/zhangqi/Downloads/zhang.jpg') eidText = Tkinter.StringVar(root) eidText.set('1557') eid = Tkinter.OptionMenu(root, eidText, "1557", "1618", "1716") eid.place(height = 40, width = 80, x = 80, y = 20) regionText = Tkinter.StringVar(root) regionText.set('GBeng') region = Tkinter.OptionMenu(root, regionText, "GBeng", "CAeng", "CAfre") region.place(height = 40, width = 80, x = 240, y = 20) start = Tkinter.Button(root, text = 'Start', command = lambda:startBtnClicked(str(eidText.get()), str(regionText.get()))) start.place(height = 45, width = 200, x = 100, y= 90) Tkinter.mainloop()
版权声明:本文为博主原创文章,未经博主允许不得转载。