Python定义点击右上角关闭按钮事件(Python defines the event of clicking the close button in the upper right corner) 文章来自:https://www.cnblogs.com/iAmSoScArEd/p/11200029.html 爬虫.转载请注明出处. import tkinterimport tkinter.messagebox def callbackClose(): tkinter.messagebox.…
用Python实现常量 定义 # coding=utf-8 # const.py class ConstAssignError(Exception): pass class _const(object): def __setattr__(self, k, v): if k in self.__dict__: raise ConstAssignError, "Can't rebind const (%s)" % k else: self.__dict__[k] = v def _test…
在test.py文件里面 #coding=utf-8 #类的定义 class user: #定义私有属性 __name = '' __age = 0 #定义基本属性 sex = '' #定义构造函数 def __init__(self, n,a,s): self.__name = n self.__age = a self.sex = s #定义普通函数 def printf(self): print "my name is %s" %(self.__name) print "…