i'm trying to access variables and functions from "juego.py" file, which is in the same folder, but i'm getting an error. The current file name is "pantalla_fin.py"
Error: File "c:\Users\danie\OneDrive\Escritorio\PROGRAMACIÓN\ArchivosPyhton\Pong\view\pantalla_fin.py", line 5, in game_over_y = juego.VENTANA_VERTICAL/3 AttributeError: partially initialized module 'juego' has no attribute 'VENTANA_VERTICAL' (most likely due to a circular import)
import juego
import pygame
# Coordinates depending on the message
game_over_y = juego.VENTANA_VERTICAL/3
pulsar_y = juego.VENTANA_VERTICAL/3+75
# Function that draws the text
def escribir_mensaje(tamaño, frase, y):
font = pygame.font.Font("C:/Users/danie/OneDrive/Escritorio/PROGRAMACIÓN/ArchivosPyhton/Pong/imagenes_y_fuentes/fuente_numeros.ttf", tamaño)
ancho = font.height(frase)
x = juego.VENTANA_HORIZONTAL/2 - ancho/2
mensaje = font.render(frase, True, (255, 255, 255))
juego.ventana.blit(mensaje, (x, y))
# Main function
def game_over(ganador):
running = True
while running:
juego.ventana.fill(juego.NEGRO)
if ganador == "score1":
escribir_mensaje(64, "You have won", game_over_y)
elif ganador == "score2":
escribir_mensaje(64, "Game Over", game_over_y)
escribir_mensaje(16, "Click to restart", pulsar_y)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button==1:
juego.main()
pygame.display.flip()
pygame.time.Clock().tick(juego.FPS)
pygame.quit()
game_over("score1")
juego.py. - import random