At 08:52 PM 11/20/2005, ->Terry<- wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Ok, I've got my peg game roughed out and I'm having
problems.

The error is:

Traceback (most recent call last):
   File "pypeg.py", line 113, in ?
     main()
   File "pypeg.py", line 107, in main
     x.draw_board()                     # Refresh screen
   File "pypeg.py", line 30, in draw_board
     screen.blit(Peg.peg, (Peg.pegs[i]))  # Blit it.
AttributeError: class Peg has no attribute 'peg'

screen.blit(Peg.peg, (Peg.pegs[i]))

Peg is the name of a class rather than an instance of a class.
Instances of Peg have the attribute peg. The class itself does not.
Without analyzing your code in detail I'm not sure of the fix, except to suggest you put an instance of Peg in place of Pe.

The new code is at:

< URL:http://members.socket.net/~tvbare/pypeg/new_pypeg.py>

I'm confused as to why. The whole OO picture
has my head reeling, but I thought I had some
grasp of the basics. Now I'm not so sure. d:^)

Thanks much,
- --
     Terry


"Be who you are and say what you feel, because those
  who mind don't matter and those who matter don't mind."
                                  -- Dr. Seuss
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)

iD8DBQFDgVKHQvSnsfFzkV0RAnlyAJ9snqBt0GOWS7IpimsMkB2xaBqu2gCbBovs
ATTVhm0JbWiz+VfKSxXrGqY=
=oGAu
-----END PGP SIGNATURE-----

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to