Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # !/usr/bin/python
- # PyRs_Phone.py
- # Symbianer's Keep Coding
- import appuifw
- import graphics
- from switchoff import*
- import globalui
- import e32
- import random
- import key_codes
- play=True
- def exit_key():
- global play
- play=False
- appuifw.app.set_exit()
- appuifw.app.screen="full"
- img=None
- def Redraw(rect):
- if img:cv.blit(img)
- appuifw.app.body=cv=appuifw.Canvas(redraw_callback=Redraw)
- img=graphics.Image.new(cv.size)
- x,y=10,10
- px,py=20,20
- state=False
- def up():
- global state
- state-=True
- if state<False:
- state=False
- def down():
- global state
- state+=False
- if state>2:
- state=True
- def down():
- global state
- state+=True
- if state>True:
- state=2
- def down():
- global state
- state+=True
- if state>2:
- state=3
- def press():
- [Mati_Hidup,Mati_Doang,Tentang,exit_key][state]()
- def Mati_Hidup():
- Restart()
- def Mati_Doang():
- Shutdown()
- def Tentang():
- globalui.global_msg_query(u"Tulis tentang aplikasi kamu disini",u"Tentang Aplikasi :")
- while play:
- img.clear(0x111111)
- if y>cv.size[0]:
- y=1
- x=random.randint(0,cv.size[0])
- y+=1
- if px>cv.size[0]:
- px=1
- py=random.randrange(0,cv.size[1])
- px+=1
- img.point((x,y),random.randrange(0xffffff),width=2)
- img.point((px,py),random.randrange(0xffffff),width=2)
- img.rectangle((20,30,160,60),(0,0,255),fill=(143,143,0),width=1.5)
- img.text((60,55),u"Restart",(255,255,255),font=(u"Sans MT_936_s60",20))
- img.rectangle((20,70,160,100),(0,255,0),fill=(143,0,143),width=1.5)
- img.text((45,95),u"Shuthdown",(255,255,255),font=(u"Sans MT_936_s60",20))
- img.rectangle((20,110,160,140),(255,255,0),fill=(143,0,0),width=1.5)
- img.text((60,135),u"Tentang",(255,255,255),font=(u"Sans MT_936_s60",20))
- img.rectangle((20,150,160,180),(183,0,143),fill=(143,183,183),width=1.5)
- img.text((80,175),u"Exit",(0,0,0),font=(u"Sans MT_936_s60",20))
- img.text((100,220),u"PyRs_Phone",0xB200ff,font=(u"Sans MT_936_s60",20))
- if state==False:
- img.rectangle((20,30,160,60),random.randrange(0xffeeaa),width=1)
- if state==True:
- img.rectangle((20,70,160,100),random.randrange(0xffeeaa),width=1)
- if state==2:
- img.rectangle((20,110,160,140),random.randrange(0xffeeaa),width=1)
- if state==3:
- img.rectangle((20,150,160,180),random.randrange(0xffeeaa),width=1)
- cv.bind(key_codes.EKeySelect,press)
- cv.bind(key_codes.EKeyUpArrow,up)
- cv.bind(key_codes.EKeyDownArrow,down)
- Redraw(())
- e32.ao_sleep(1E-04)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement