rendered paste bodyimport pygame, sys, os
from pygame.locals import *
# Initialize all Pygame modules.
pygame.init( )
# Sets up a window 640x480. Returns a surface, in this case, the surface we will use as the display.
Screen = pygame.display.set_mode( ( 640, 480 ), HWSURFACE | DOUBLEBUF )
# Sets the title to "Simple Draw".
pygame.display.set_caption( 'Simple Draw' )
ScreenRect = Screen.get_rect( )
while( 1 ):
for event in pygame.event.get( ):
if event.type == QUIT:
sys.exit( 0 );
elif event.type == MOUSEBUTTONDOWN and event.button == 1:
OldPos = pygame.mouse.get_pos( )
Clicked = pygame.mouse.get_pressed( )
if Clicked[0] == True:
NewPos = pygame.mouse.get_pos( )
pygame.draw.line( Screen, ( 255, 255, 255 ), OldPos, NewPos, 2 )
OldPos = pygame.mouse.get_pos( )
pygame.display.flip( )