python时钟源码
话不多说,代码如下
# encoding: utf-8
"""
@version: ??
@author:
@file: 时钟.py
@time: 2020/4/9 21:43
"""
import sys, random, math, pygame
from pygame.locals import *
from datetime import datetime, date, time
def print_text(font, x, y, text, color=(255, 255, 255), ):
imgText = font.render(text, True, color, )
screen.blit(imgText, (x, y))
def wrap_angle(angle):
return angle % 360
# main program begins
pygame.init()
screen = pygame.display.set_mode((600, 500))
pygame.display.set_caption('Analog Clock Demo')
font = pygame.font.Font(None, 36