So this is my class for a game called Zombie Dice.
I've imported graphics but I get this error and I have no idea why. Please explain some possibilities for me.
"File "<pyshell#0>", line 1, in <module>
Game()
File "C:\Users\Brandon\Desktop\FinalProject3.py", line 17, in Game
Yellow = DieViewYellow(Gamewindow, Point(95,75),20)
File "C:\Users\Brandon\Desktop\DieViewYellow.py", line 83, in __init__
p1 = Point(x-25, y-25)
NameError: name 'Point' is not defined">
Here is my Die view class, which is giving me the issue even though graphics is imported
#Die View Yellow
from graphics import *
class DieViewYellow:
def __init__(self, win, center, value):
"""Create a view of a die, e.g.:
d1 = GDie(myWin, Point(40,50), 20)
creates a die centered at (40,50) having sides
of length 20."""
# first define some standard values
self.win = win
#self.background = Color # color of die face
#self.foreground = Color2 # color of the pips
# create a square for the face
if value==0:
x, y = center.getX(), center.getY()
p1 = Point(x-25, y-25)
p2 = Point(x+25, y+25)
rect = Rectangle(p1,p2)
rect.draw(win)
rect.setFill('yellow')
if value == 1:
x, y = center.getX(), center.getY()
p1 = Point(x-25, y-25)
p2 = Point(x+25, y+25)
rect = Rectangle(p1,p2)
rect.draw(win)
rect.setFill('yellow')
self.Brain=Text(Point(95,75),'B')
self.Brain.draw(self.win)
elif value == 2:
x, y = center.getX(), center.getY()
p1 = Point(x-25, y-25)
p2 = Point(x+25, y+25)
rect = Rectangle(p1,p2)
rect.draw(win)
rect.setFill('yellow')
self.Brain=Text(Point(95,75),'B')
self.Brain.draw(self.win)
elif value == 3:
x, y = center.getX(), center.getY()
p1 = Point(x-25, y-25)
p2 = Point(x+25, y+25)
rect = Rectangle(p1,p2)
rect.draw(win)
rect.setFill('yellow')
self.Shotgun=Text(Point(95,75),'S')
self.Shotgun.draw(self.win)
elif value == 4:
x, y = center.getX(), center.getY()
p1 = Point(x-25, y-25)
p2 = Point(x+25, y+25)
rect = Rectangle(p1,p2)
rect.draw(win)
rect.setFill('yellow')
self.Foot=Text(Point(95,75),'F')
self.Foot.draw(self.win)
elif value == 5:
x, y = center.getX(), center.getY()
p1 = Point(x-25, y-25)
p2 = Point(x+25, y+25)
rect = Rectangle(p1,p2)
rect.draw(win)
rect.setFill('yellow')
self.Foot=Text(Point(95,75),'F')
self.Foot.draw(self.win)
else:
x, y = center.getX(), center.getY()
p1 = Point(x-25, y-25)
p2 = Point(x+25, y+25)
rect = Rectangle(p1,p2)
rect.draw(win)
rect.setFill('yellow')
self.Shotgun=Text(Point(95,75),'S')
self.Shotgun.draw(self.win)