Archived:Displaying a bouncing ball using PySymbian
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.
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 is a code snippet shows how to use the PySymbian graphics module to draw a circle that will move around the screen.
Article Metadata
Tested with
Devices(s): Nokia N70
Compatibility
Platform(s): S60 1st Edition, S60 2nd Edition, S60 3rd Edition
Platform Security
Signing Required: Self-Signed
Capabilities: None
Article
Keywords: appuifw, time, math, graphics
Created: james1980
(31 Dec 2008)
Last edited: hamishwillee
(08 May 2013)
Code Snippet
import e32,random
import time
import appuifw
import graphics
import math
running=1
def quit():
global running
running=0
appuifw.app.exit_key_handler=quit
appuifw.app.screen='large'
can=appuifw.Canvas()
appuifw.app.body=can
j,k=can.size
dx=1
dy=1
x1=10
y1=10
while running:
x1=x1+dx
y1=y1+dy
x2=x1+10
y2=y1+10
if x1<1:
dx=dx*-1
if y1<1:
dy=dy*-1
if x1>j-15:
dx=dx*-1
if y1>k-15:
dy=dy*-1
c=random.randrange(0xffffff)
can.ellipse((x1,y1,x2,y2),outline=None,fill=c)
e32.ao_sleep(.03)
can.clear(0xffffff)
e32.ao_yield()
To do
Add comments to the source


20 Sep
2009