zoukankan      html  css  js  c++  java
  • 在屏幕上随机画点

    屏幕慢慢被各种色彩填满,很舒服看上去

    #_*_coding:utf-8 _*_
    from time import sleep
    
    import pygame
    from pygame.locals import  *
    from sys import exit
    from random import randint
    
    pygame.init()
    screen=pygame.display.set_mode((640,480),0,32)
    while True:
        for event in pygame.event.get():
            if event.type==QUIT:
                exit()
        rand_col=(randint(0,255),randint(0,255),randint(0,255))
        #screen.lock()
        for _ in xrange(100):
            rand_pos=(randint(0,639),randint(0,479))
            screen.set_at(rand_pos,rand_col)
        #screen.unlock()
        #sleep(1)
        pygame.display.update()
  • 相关阅读:
    【leetcode】图像渲染
    【leetcode】不邻接植花
    052-75
    052-74
    052-73
    052-71
    052-70
    052-69
    052-67
    052-66
  • 原文地址:https://www.cnblogs.com/superxuezhazha/p/7439593.html
Copyright © 2011-2022 走看看