美文网首页
day-15 作业

day-15 作业

作者: 哗啦噼里啪啦 | 来源:发表于2018-11-24 11:16 被阅读0次
    import pygame
    from color import Color
    def my_write(size1,font1,coordinate,color=Color.black):
        font = pygame.font.SysFont('SimHei', size1)
        text1 = font.render(font1, True, color)
        return window.blit(text1, coordinate)
    pygame.init()
    window=pygame.display.set_mode((400,400))
    window.fill(Color.rand_color())
    pygame.display.flip()
    tupian=pygame.image.load('files/微信图片_20181123144455.jpg')
    new_tupian=pygame.transform.rotozoom(tupian,0,1/6)
    window.blit(new_tupian,(2,2))
    pygame.display.flip()
    my_write(20,'欢迎来到学生管理系统',(130,30),Color.red)
    pygame.display.flip()
    width=240
    height=40
    pygame.draw.rect(window, Color.rand_color(), (80, 120, width, height))
    pygame.display.flip()
    pygame.draw.rect(window, Color.rand_color(), (80, 180, width, height))
    pygame.display.flip()
    pygame.draw.rect(window, Color.rand_color(), (80, 280, width, height))
    pygame.display.flip()
    my_write(20,'账号:',(90,130))
    pygame.display.flip()
    my_write(20,'密码:',(90,190))
    pygame.display.flip()
    my_write(20,'登录',(180,290))
    pygame.display.flip()
    while True:
        for event in pygame.event.get():
            if event.type==pygame.QUIT:
                exit()
            elif event.type==pygame.MOUSEBUTTONDOWN:
                if 80<list(event.pos)[0]<360 and 280<list(event.pos)[1]<320:
                    print(event.pos)
                    window.fill(Color.rand_color())
                    pygame.display.flip()
                    my_write(60,'❤登录成功❤',(20,180))
                    pygame.display.flip()
                    window.blit(new_tupian, (0,0))
                    pygame.display.flip()
                    window.blit(new_tupian, (290,0))
                    pygame.display.flip()
                    window.blit(new_tupian, (0,340))
                    pygame.display.flip()
                    window.blit(new_tupian, (290,340))
                    pygame.display.flip()
            else:
                pass
    

    相关文章

      网友评论

          本文标题:day-15 作业

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