ConsoleFW

#/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()


内容概要:本文详细介绍了Python编程中的模块和面向对象思想。首先,阐述了Python在当今编程领域的广泛应用,包括人工智能、数据分析和网络爬虫等。接着,文章深入讲解了Python模块的概念,包括模块的作用、常见的内置模块(如math模块)及其导入方式(import、from...import、from...import *),以及如何创建自定义模块和包。随后,文章探讨了面向对象编程思想的诞生背景及其基本概念,包括对象、类、属性和方法,并重点介绍了面向对象的三大特征:封装、继承和多态。最后,文章通过一个学生管理系统的案例,展示了模块与面向对象思想在实际项目中的结合应用。 适合人群:对Python编程感兴趣的初学者,以及希望深入了解模块和面向对象编程的中级开发者。 使用场景及目标:①理解Python模块的使用方法,包括导入方式和自定义模块的创建;②掌握面向对象编程的基本概念和特性,如类、对象、封装、继承和多态;③学会将模块与面向对象思想结合应用于实际项目开发,提高代码的可维护性和复用性。 阅读建议:本文内容详实,涵盖模块和面向对象编程的基础理论与实践案例。读者应结合实际编程练习,逐步掌握模块的使用技巧和面向对象编程的核心思想。特别是通过案例分析部分,读者可以更好地理解如何将理论应用于实际项目中,提升编程能力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值