zoukankan      html  css  js  c++  java
  • python小工具收集GUID2class

    # -*- coding: utf-8 -*-
    '''
    Created on 2012-9-16

    @author: IBM
    '''
    from Tkinter import *
    from docutils.nodes import row
    from win32event import *
    from win32api import *
    import win32api

    class EntryFormatting:
    def __init__(self, master):
    frame = Frame(master)
    Label(frame, text=' ').grid(row=0, column=0, sticky=W)
    Label(frame, text=' ').grid(row=0, column=3, sticky=W)

    self._EdtGUID=self.createField(frame, width=26, row=0, col=2,
    label='GUID', format=self.fmtGUID,
    enter=self.activate, change=self.edtChg)
    self._LabelclsName = self.createField(frame, width=26, row=1, label='程序名',
    col=2, enter=self.activate)
    frame.pack(side=TOP, padx=15, pady=15)

    def createField(self, master, label='', text='', width=1, format=None,
    enter=None, row=0, col=0, change=None):
    Label(master, text=label).grid(row=row, column=col-1, padx=15, sticky=W)
    id = Entry(master, text=label, width=width, takefocus=1)
    id.bind('<KeyRelease>', format)
    id.bind('<<Modified>>', change)
    id.bind('<Return>', enter)
    id.grid(row=row, column=col, pady=10, sticky=W)

    def activate(self, event):
    print '<Return>: value is', event.widget.get()

    def fmtGUID(self, event):
    current = event.widget.get()
    from test.test_iterlen import len
    if len(current) != 16:
    self._EdtGUID.text = 'please input right GUID'

    def edtChg(self, event):
    ''''''
    handle = win32api.LoadLibrary('ole32')
    funcProgIdFromClsid = win32api.GetProcAddress(handle, 'ProgIDFromCLSID')
    lpszProgid = ''
    funcProgIdFromClsid(lpszProgid, event.widget.get())
    self._LabelclsName.text = lpszProgid

    if __name__ == '__main__':
    root = Tk()
    root.title('GUID2Class')

    top = EntryFormatting(root)
    quit = Button(root, text="Quit", command=root.destroy)
    quit.pack(side="bottom")

    root.mainloop()
    pass

  • 相关阅读:
    Web Site 与 Web Application 的区别
    Jquery获取text,areatext,radio,checkbox,select值
    C#怎么样操作world文档中的文字型窗体域?
    DataFormatString 用法
    overload和override的区别
    Apollo安装
    工控机基础
    CAN总线技术基础
    dd命令_Linux dd命令:复制(拷贝)文件,并对原文件进行转换
    Unity2021零基础入门教程
  • 原文地址:https://www.cnblogs.com/maifengqiang/p/2687431.html
Copyright © 2011-2022 走看看