I am trying to make a simple snake game off a tutorial and the game is incomplete but I am supposed to be able to get the pygame gameboard or surface to open and show the basic grid structure but it shows the pygame window as not responding. I've already installed pygame on the anaconda prompt with pip install pygame
. I am using Spyder 5, and python 3.8.10 and pygame 2.0.1.
import math
import random
import pygame
import tkinter as tk
from tkinter import messagebox
class cube(object):
rows = 0
w = 0
def _init_(self, start,dirnx=1, dirny=0, color=(255, 0, 0)):
pass
def move(self, dirnx, dirny):
pass
def draw(self, surface, eyes=False):
pass
class snake(object):
def _init_(self, color, pos):
pass
def move(self):
pass
def reset(self, pos):
pass
def addCube(self):
pass
def draw(self, surface):
pass
def drawGrid(w, rows, surface):
sizeBtwn = w // rows
x = 0
y = 0
for l in range(rows):
x = x + sizeBtwn
y = y + sizeBtwn
pygame.draw.line(surface, (255, 255, 255), (x, 0), (x, w))
pygame.draw.line(surface, (255, 255, 255), (0, y), (w, y))
def drawWindow (surface):
global rows, width
surface.fill((0, 0, 0))
drawGrid(width, rows, surface)
pygame.display.update()
def randomSnack(rows, items):
pass
def message_box(subject, content):
pass
def main() :
global width, rows
width = 500
height = 500
rows = 20
win = pygame.display.set_mode((width, width))
s = snake((255, 0, 0), (10, 10))
flag = True
clock = pygame.time.Clock()
while flag:
pygame.time.delay(50)
clock.tick(10)
redrawWindow(win)
pass
main()