Advertisement
Guest User

PyRs_Phone

a guest
Nov 4th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # !/usr/bin/python
  2. # PyRs_Phone.py
  3. # Symbianer's Keep Coding
  4.  
  5. import appuifw
  6. import graphics
  7. from switchoff import*
  8. import globalui
  9. import e32
  10. import random
  11. import key_codes
  12.  
  13. play=True
  14. def exit_key():
  15.     global play
  16.     play=False
  17.     appuifw.app.set_exit()
  18.  
  19. appuifw.app.screen="full"
  20. img=None
  21. def Redraw(rect):
  22.     if img:cv.blit(img)
  23. appuifw.app.body=cv=appuifw.Canvas(redraw_callback=Redraw)
  24. img=graphics.Image.new(cv.size)
  25. x,y=10,10
  26. px,py=20,20
  27. state=False
  28. def up():
  29.     global state
  30.     state-=True
  31.     if state<False:
  32.         state=False
  33. def down():
  34.     global state
  35.     state+=False
  36.     if state>2:
  37.         state=True
  38. def down():
  39.     global state
  40.     state+=True
  41.     if state>True:
  42.         state=2
  43. def down():
  44.     global state
  45.     state+=True
  46.     if state>2:
  47.         state=3
  48. def press():
  49.     [Mati_Hidup,Mati_Doang,Tentang,exit_key][state]()
  50.  
  51. def Mati_Hidup():
  52.     Restart()
  53.  
  54. def Mati_Doang():
  55.     Shutdown()
  56.  
  57. def Tentang():
  58.     globalui.global_msg_query(u"Tulis tentang aplikasi kamu disini",u"Tentang Aplikasi :")
  59.  
  60. while play:
  61.     img.clear(0x111111)
  62.     if y>cv.size[0]:
  63.         y=1
  64.         x=random.randint(0,cv.size[0])
  65.     y+=1
  66.     if px>cv.size[0]:
  67.         px=1
  68.         py=random.randrange(0,cv.size[1])
  69.     px+=1
  70.     img.point((x,y),random.randrange(0xffffff),width=2)
  71.     img.point((px,py),random.randrange(0xffffff),width=2)
  72.     img.rectangle((20,30,160,60),(0,0,255),fill=(143,143,0),width=1.5)
  73.     img.text((60,55),u"Restart",(255,255,255),font=(u"Sans MT_936_s60",20))
  74.  
  75.     img.rectangle((20,70,160,100),(0,255,0),fill=(143,0,143),width=1.5)
  76.     img.text((45,95),u"Shuthdown",(255,255,255),font=(u"Sans MT_936_s60",20))
  77.  
  78.     img.rectangle((20,110,160,140),(255,255,0),fill=(143,0,0),width=1.5)
  79.     img.text((60,135),u"Tentang",(255,255,255),font=(u"Sans MT_936_s60",20))
  80.    
  81.     img.rectangle((20,150,160,180),(183,0,143),fill=(143,183,183),width=1.5)
  82.     img.text((80,175),u"Exit",(0,0,0),font=(u"Sans MT_936_s60",20))
  83.    
  84.    
  85.     img.text((100,220),u"PyRs_Phone",0xB200ff,font=(u"Sans MT_936_s60",20))
  86.     if state==False:
  87.         img.rectangle((20,30,160,60),random.randrange(0xffeeaa),width=1)
  88.     if state==True:
  89.         img.rectangle((20,70,160,100),random.randrange(0xffeeaa),width=1)
  90.     if state==2:
  91.         img.rectangle((20,110,160,140),random.randrange(0xffeeaa),width=1)
  92.     if state==3:
  93.         img.rectangle((20,150,160,180),random.randrange(0xffeeaa),width=1)
  94.     cv.bind(key_codes.EKeySelect,press)
  95.     cv.bind(key_codes.EKeyUpArrow,up)
  96.     cv.bind(key_codes.EKeyDownArrow,down)
  97.  
  98.     Redraw(())
  99.     e32.ao_sleep(1E-04)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement