# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: test
Description :
Author : LPP
date: 2018/7/28
-------------------------------------------------
Change Activity:
2018/7/28:
-------------------------------------------------
"""
__author__ = 'LPP'
import pygame
from math import pi
from random import randint
if __name__ == '__main__':
pygame.init()
width = 800
height = 800
screen = pygame.display.set_mode((800, 800))
screen.fill((255, 255, 255))
font = pygame.font.Font('./aa.ttf', 100)
for x in range(0, width, 50):
pygame.draw.line(screen, (0, 0, 0), (x, 0), (x, height))
# surface = font.render(str(x), True, (255, 0, 165))
# screen.blit(surface, (x, 0))
for y in range(0, height, 50):
pygame.draw.line(screen, (0, 0, 0), (0, y), (width, y))
# surface = font.render(str(y), True, (255, 0, 165))
# screen.blit(surface, (0, y))
# page = pygame.image.load('./page.jpg')
# 鼻子
pygame.draw.ellipse(screen, (0, 0, 0), (95, 345, 130, 160), 5)
pygame.draw.ellipse(screen, (255, 189, 222), (100, 350, 120, 150), 0)
# 鼻孔
pygame.draw.ellipse(screen, (0, 0, 0), (140, 390, 40, 20), 0)
pygame.draw.ellipse(screen, (0, 0, 0), (140, 430, 40, 20), 0)
# 头部的轮廓
pygame.draw.arc(screen, (0, 0, 0), (130, 300, 450, 150), pi/12, pi*8/9, 3)
pygame.draw.arc(screen, (0, 0, 0), (287, 319, 360, 360), pi*9.8/9, pi*3.7/12, 3)
pygame.draw.arc(screen, (0, 0, 0), (145, 410, 400, 145), pi*14/13, pi * 2.9/2, 3)
# 左眼
pygame.draw.circle(screen, (0, 0, 0), (350, 370), 28, 3)
pygame.draw.circle(screen, (0, 0, 0), (355, 375), 8, 0)
# 右眼
pygame.draw.circle(screen, (0, 0, 0), (420, 375), 28, 3)
pygame.draw.circle(screen, (0, 0, 0), (425, 380), 8, 0)
# 嘴巴
pygame.draw.arc(screen, (0, 0, 0), (340, 510, 140, 110), pi, 0, 5)
# 腮帮
pygame.draw.ellipse(screen, (255, 192, 233), (480, 430, 140, 110), 0)
pygame.draw.ellipse(screen, (0, 0, 0), (479, 429, 141, 111), 1)
# 耳朵
pygame.draw.arc(screen, (0, 0, 0), (480, 250, 60, 110), -pi/6, pi*7/6, 5)
pygame.draw.arc(screen, (0, 0, 0), (410, 232, 60, 110), -pi / 6, pi * 7 / 6, 5)
while True:
surface = font.render('小猪佩奇身上纹', True, (randint(0, 255), randint(0, 255), randint(0, 255)))
screen.blit(surface, (50, 50))
pygame.display.flip()
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()