Oct-03-2017, 03:24 PM
(This post was last modified: Oct-03-2017, 03:27 PM by JamieVanCadsand.)
Hey Game Developers...
I try to create more tekst fonts in one game window, in one script...
But it don't works...
This is my script:
Can anyone give my an example code to lost this problem ?...
Thanks, Jamie.
I try to create more tekst fonts in one game window, in one script...
But it don't works...
This is my script:
from datetime import datetime
import pygame
import sys
pygame.init()
size = (640, 480)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Clock")
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
done = False
clock = pygame.time.Clock()
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
done = True
screen.fill(WHITE)
now = datetime.now()
font1 = pygame.font.SysFont('Calibri', 25, True, False)
text1 = font.render('Sec: ' + str(now.second), True, GREEN)
screen.blit(text1, [320, 240])
font2 = pygame.font.SysFont('Calibri', 25, True, False)
text2 = font.render('Min: ' + str(now.minute), True, GREEN)
screen.blit(text2, [320, 230])
font3 = pygame.font.SysFont('Calibri', 25, True, False)
text3 = font.render('Hou: ' + str(now.hour), True, GREEN)
screen.blit(text3, [320, 220])
pygame.display.flip()
clock.tick(60)
pygame.quit()
sys.exit()Pygame don't run my game perfect, my screen is black... please whats wrong with my code ?...Can anyone give my an example code to lost this problem ?...
Thanks, Jamie.
