User Tools

Site Tools


python:apskritimai

Paišom apskritimus atsitiktinai:

import sys
import random
import pygame as game
 
 
def veiksmai():
    for event in game.event.get():
        if event.type == game.QUIT:
            sys.exit()
 
 
game.init()
size = width, height = 640, 480
screen = game.display.set_mode(size)
screen.fill(game.Color('black'))
 
while True:
    x = random.randint(0, width)
    y = random.randint(0, height)
    r = random.randint(10, min(width, height) // 3)
    color = game.Color(*[random.randint(0, 255) for i in range(4)])
    game.draw.circle(screen, color, (x, y), r)
    game.display.flip()
    game.time.wait(200)
    veiksmai()

Rezultatas:

python/apskritimai.txt · Last modified: by mantas