saya mencoba mengeksekusi kode ini:
import Tkinter as tk
import tkFont
import functools
import math
import random
import time
class Pong(tk.Canvas):
DEFAULTS = dict(width=640, height=480,background='black',highlightthickness=0)
def main(cls):
root = tk.Tk()
root.title('Pong')
root.resizable(False, False)
root.bind_all('<Escape>', lambda event: root.destroy())
game = cls(tkFont.Font(family='Book Antiqua', size=15, weight='bold'), 5, 100,background='black', width=640, height=480)
game.grid()
root.mainloop()
tapi saya punya kesalahan itu:
Traceback (most recent call last):
line 413, in <module>
pong.main()
, line 17, in main
game = cls(tkFont.Font(family='Book Antiqua', size=15, weight='bold'), 5, 100,background='black', width=640, height=480)
AttributeError: Pong instance has no __call__ method
pong.main()
dan sedikit sebelum tempat Anda menugaskanpong
? - person poke   schedule 16.01.2014