# Archived:How to make Random Rectangle in PySymbian- Part 2

Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

This code snippet shows how to use the PySymbian graphics module to draw a rectangle and fill it with random color.

Tested with
Devices(s): N70, N95 8gb

Compatibility
Platform(s): S60 1st Edition, S60 2nd Edition, S60 3rd Edition

Article
Keywords: appuifw, time, math, graphics
Created: james1980 (31 Dec 2008)
Last edited: hamishwillee (08 May 2013)

## Code Snippet

`import e32import randomimport timeimport appuifwimport graphicsimport math appuifw.app.title = u"Random Rectangle-2" #set the application titlecan=appuifw.Canvas() #create a canvas classappuifw.app.body=can  #assign the canvas to the bodyimg=graphics.Image.new(can.size) #create a new image instanceimg.clear(0xffffff)     #clear the image running=1 def quit():    global running    running=0 appuifw.app.exit_key_handler=quit while running: # below acript makes the random rectangles 	for i in range(1,70):	    a=random.randrange(255) #defines the position of the rectangles	    b=random.randrange(255)	    c=random.randrange(255)	    j=i+1	    x1=(can.size[0]/2)-j #defines the position of the rectangle	    y1=(can.size[1]/2)-j	    x2=(can.size[0]/2)+j	    y2=(can.size[1]/2)+j	    img.rectangle((x1,y1,x2,y2),outline=None,fill=(a,b,c))	    img.rectangle((x1+10,y1+10,x2-10,y2-10),outline=None,fill=0xffffff) 	    can.blit(img)	    e32.ao_sleep(.1)    	e32.ao_yield()`

## Screenshots

The below are some screenshots of the above code snippet