rect ( screen, BLUE, ( start, size ), 1 ) pygame. ![]() fill ( GRAY ) for rect in rect_list : pygame. pos size = end - start, end - start screen. type = MOUSEMOTION and drawing : end = event. append ( rect ) drawing = False elif event. 1 simple pygame program 2 3 import and initialize the pygame library 4 import pygame 5 pygame. pos size = end - start, end - start rect = pygame. pencolor(color) used to set the colour used to draw lines on the screen the color can be specied in. pos size = 0, 0 drawing = True elif event. 133 12.6 A More Interactive pygame Application. type = QUIT : running = False elif event. ![]() Pygame, in addition to adapting SDL to Python, also provides a small number of functions. set_mode (( 640, 240 )) start = ( 0, 0 ) size = ( 0, 0 ) drawing = False rect_list = running = True while running : for event in pygame. You can draw shapes like arc, line, oval, rectangle, polygon. """Place multiple rectangles with the mouse.""" import pygame from pygame.locals import * RED = ( 255, 0, 0 ) BLUE = ( 0, 0, 255 ) GRAY = ( 127, 127, 127 ) pygame.
0 Comments
Leave a Reply. |