在Windows7上使用Python3。在
import pickle
import os.path
from tkinter import * # Import tkinter
import tkinter.messagebox
class Places:
def __init__(self, name, street, city, state, zip):
self.name = name
self.street = street
self.city = city
self.state = state
self.zip = zip
class PlacesBook:
def __init__(self):
window = Tk() # Create a window
window.title("PlacesBook") # Set title
我知道错误了builtins.name错误:在“类PlacesBook:”中未定义名称“self”:
问题是你的缩进,在Python中缩进是非常重要的,那就是你如何定义类中的代码部分,方法。。。在
另一点,如果使用python3,那么所有类都必须从object继承。在
相关问题 更多 >
编程相关推荐