1 #coding=utf-8 2 # __author__ = ‘minmin‘ 3 from Tkinter import * 4 5 #创建一个基于Frame的Application类 6 class Application(Frame): 7 #初始化 8 def __init__(self, master): 9 #super(Application, self).__init__(master) 10 Frame.__init__(self,master) 11 self.grid()
如果用super(Application, self).__init__(master)则会报错,报错内容为:TypeError(‘must be type,not classobj‘)None
可用Frame.__init__(self,master)代替
2)在PyCharm Community Edition中加入中文注释有时候会报错,需在最上行加入“#coding=utf-8”
时间: 2024-10-11 03:36:03