It this game the score is set you 0 at the beginning and added to if you answer a question correctly, If i check the score by printing while I'm playing it gives the correct value but when the score is shown on the certificate it displays 0 no matter what.
Here's the code for the first file (The game part)
import pygame, time
pygame.init()
WHITE = ( 255, 255, 255)
BLACK = ( 0, 0, 0)
screen = pygame.display.set_mode((600, 600))
ButtonA = pygame.image.load("A.png")
ButtonB = pygame.image.load("B.png")
ButtonC = pygame.image.load("C.png")
a = screen.blit(ButtonA,(50,400))
b = screen.blit(ButtonB,(250,400))
c = screen.blit(ButtonC,(450,400))
pygame.display.flip()
score = 0
if __name__ == '__main__':
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.MOUSEBUTTONDOWN:
pos = pygame.mouse.get_pos()
if a.collidepoint(pos):
screen.fill(BLACK)
Correct = font.render("You are correct!", True, WHITE)
Correct_rect = Correct.get_rect()
Correct_x = screen.get_width() / 2 - Correct_rect.width / 2
Correct_y = 150 - Correct_rect.height / 2
screen.blit(Correct, [Correct_x, Correct_y])
pygame.display.flip()
score = score + 1
print score
time.sleep(2)
And here is the code for the part where it puts the value on a certificate which currently throws up nothing but the number 0
import pygame, sys, eztext
from pygame.locals import *
from eztext import Input
#Importing the variable score
from Question1Easy import score
Name = self.value
#Setting the variable score (an int) to a string
Score = str(score)
How do I get the second file to grab the updated value of score instead of the static 0?