Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # simple slide by joe
- # 26/10/2014
- import os
- import appuifw as A
- import graphics as G
- layar=G.sysinfo.display_pixels()
- img=G.Image.new(layar)
- run=1
- def q():
- global run
- run=0
- def skala(w,h,bw,bh,fit=1):
- nw=bh*w/h
- nh=bw*h/w
- if fit ^(nw>=bw):
- return nw or 1,bh
- return bw,nh or 1
- def draw(x):
- c.blit(img)
- c=A.Canvas(redraw_callback=draw)
- A.app.screen='full'
- A.app.body=c
- A.app.menu=[]
- A.app.exit_key_handler=q
- d=u'E:\\Images\\'
- lst=[os.path.join(d,i) for i in os.listdir(d)]
- list_gbr=filter(lambda f: os.path.isfile(f) and f.endswith('.jpg'), lst)
- def slide():
- for i in xrange(len(list_gbr)):
- if not run:return
- if i>len(list_gbr):
- i=0
- img.clear(0)
- try:
- gbr=G.Image.open(list_gbr[i])
- sz=skala(gbr.size[0],gbr.size[1],176,208)
- img.blit(gbr.resize(sz),target=(layar[0]/2-sz[0]/2,layar[1]/2-sz[1]/2))
- img.text((5,20), u'Gambar: %d/%d' %(i+1,len(list_gbr)), 0xffffff, 'legend')
- except:
- img.text((5,20), u'Tidak bisa ditampilkan', 0xffffff, 'legend')
- c.blit(img)
- A.e32.ao_sleep(2)
- slide()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement