Created
June 26, 2014 11:08
-
-
Save PMaynard/17b9668353bc9ee2428f to your computer and use it in GitHub Desktop.
Simple Clock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
from pygame.locals import * | |
import sys | |
from time import gmtime, strftime | |
pygame.init() | |
font = pygame.font.Font(None, 30) | |
screen = pygame.display.set_mode(font.size("XX:XX:XX")) | |
background = pygame.Surface(screen.get_size() ) | |
def update(): | |
background.fill((0,0,0)) | |
background.blit( font.render(strftime("%H:%M:%S", gmtime()), 1, (255,0,0)), (0,0)) | |
screen.blit(background, (0,0)) | |
pygame.display.update() | |
while 1: | |
for event in pygame.event.get(): | |
if event.type in (QUIT, KEYDOWN): | |
sys.exit() | |
update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment