美文网首页
pygame画布测试-自画像

pygame画布测试-自画像

作者: KingJX | 来源:发表于2018-07-28 15:30 被阅读0次
    
    
    import pygame
    import random
    import time
    
    
    if __name__ == '__main__':
        pygame.init()
        screen = pygame.display.set_mode((1920,1000))
        screen.fill((0, 0, 0))
    
        while True:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    exit()
    
            from math import pi
            a = random.randint(0,255)
            b = random.randint(0,255)
            c = random.randint(0,255)
            # 脸
            pygame.draw.rect(screen, (a, b, c), (760, 270, 350, 450))
    
    
            # 眼睛
            pygame.draw.rect(screen, (255, 255, 255), (810, 400, 90, 40))
            pygame.draw.rect(screen, (255, 255, 255), (960, 400, 90, 40))
            pygame.draw.line(screen, (0, 255, 0), (900, 420), (960, 420), 2)
    
    
            pygame.draw.rect(screen, (255, 255, 255), (880, 600, 110, 60))
    
    
            # 将内容展示在屏幕上
            pygame.display.flip()
            time.sleep(0.5)
    
    自画像.png

    相关文章

      网友评论

          本文标题:pygame画布测试-自画像

          本文链接:https://www.haomeiwen.com/subject/dopomftx.html