×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    [announce] full screen dot amtrix scroller

    Enjoy! BTW I'm loking forward to hearing your improvements :-)

    [CODE]
    #!/usr/bin/env python

    # Very simple scroller
    # (C)2006 Raul Aguaviva <raul_aguaviva@yahoo.es>

    # right/left chnge teh size of the font
    # up/down changes the speed

    import appuifw
    from graphics import *
    import e32
    from key_codes import *


    msg = appuifw.query(u'Enter message to scroll', 'text',u'HELLO WORLD ').upper()

    class Keyboard(object):
    def __init__(self,onevent=lambda:None):
    self._keyboard_state={}
    self._downs={}
    self._onevent=onevent
    def handle_event(self,event):
    if event['type'] == appuifw.EEventKeyDown:
    code=event['scancode']
    if not self.is_down(code):
    self._downs[code]=self._downs.get(code,0)+1
    self._keyboard_state
    Code:
    =1
            elif event['type'] == appuifw.EEventKeyUp:
                self._keyboard_state[event['scancode']]=0
            self._onevent()
        def is_down(self,scancode):
            return self._keyboard_state.get(scancode,0)
        def pressed(self,scancode):
            if self._downs.get(scancode,0):
                self._downs[scancode]-=1
                return True
            return False
    keyboard=Keyboard()
    
    appuifw.app.screen='full'
    img=Image.new((176,208))    
     
     
    canvas=appuifw.Canvas(event_callback=keyboard.handle_event)
    appuifw.app.body=canvas
    
    # dot matrix font only capital letters [A...Z]
    font = []
    font += [0x83, 0xED, 0xEE, 0xED, 0x83, 0xff]			
    font += [0xBE, 0x80, 0xB6, 0xB6, 0xC9, 0xff]  	
    font += [0xC1, 0xBE, 0xBE, 0xBE, 0xDD, 0xff] 
    font += [0xBE, 0x80, 0xBE, 0xBE, 0xC1, 0xff]  
    font += [0x80, 0xB6, 0xB6, 0xB6, 0xBE, 0xff]
    font += [0x80, 0xF6, 0xF6, 0xF6, 0xFE, 0xff] 
    font += [0xC1, 0xBE, 0xBE, 0xB6, 0x86, 0xff]
    font += [0x80, 0xF7, 0xF7, 0xF7, 0x80, 0xff] 
    font += [0xff, 0xbE, 0x80, 0xBe, 0xff, 0xff]   
    font += [0xdF, 0xBf, 0xBf, 0xBf, 0xC0, 0xff]  
    font += [0x80, 0xf7, 0xeB, 0xDD, 0xbE, 0xff] 
    font += [0x80, 0xbF, 0xbF, 0xbF, 0xbF, 0xff]   
    font += [0x80, 0xfD, 0xf3, 0xfD, 0x80, 0xff]
    font += [0x80, 0xfB, 0xf7, 0xeF, 0x80, 0xff] 
    font += [0xc1, 0xbE, 0xbE, 0xbE, 0xc1, 0xff] 
    font += [0x80, 0xf6, 0xf6, 0xf6, 0xf9, 0xff] 
    font += [0xc1, 0xbE, 0xaE, 0xdE, 0xa1, 0xff]  
    font += [0x80, 0xf6, 0xe6, 0xd6, 0xb9, 0xff] 
    font += [0xd9, 0xb6, 0xb6, 0xb6, 0xcD, 0xff]
    font += [0xfE, 0xfE, 0x80, 0xfE, 0xfE, 0xff]   
    font += [0xc0, 0xbF, 0xbF, 0xbF, 0xc0, 0xff]  
    font += [0xf8, 0xe7, 0x9F, 0xe7, 0xf8, 0xff] 
    font += [0xc0, 0xbF, 0xc7, 0xbF, 0xc0, 0xff]  
    font += [0x9C, 0xeB, 0xf7, 0xeB, 0x9c, 0xff] 
    font += [0xfC, 0xfB, 0x87, 0xfB, 0xfC, 0xff] 
    font += [0x9E, 0xaE, 0xb6, 0xbA, 0xbC, 0xff] 
    
    
    running=1
    def quit():
        global running
        running=0
    appuifw.app.exit_key_handler=quit
    
    
    blobsize=10
    fx = 1
    fd = 1
    il = 0
    
    import time
    start_time=time.clock()
    n_frames=0
    delay = 0
    canvas.clear(0)
    
    y = 0
    x = 0
    
    while running:
    
        #take character
        c = ord(msg[(il/6)])  #take character
        if c == 32:
            r = 0xff
        else:
            r = font[(c-65)*6 + (il%6)]
        il += 1    
        if il>=len(msg)*6:
          il = 0
    
        x = (176-(7*blobsize))/2
        p = 1
        for j in range(0,7):
            if ((r & p) == 0):
                canvas.rectangle((x,y,x+blobsize,y+blobsize), fill = 0xff0000)
            else:
                canvas.rectangle((x,y,x+blobsize,y+blobsize), fill = 0x000000)
            p = p * 2
            x = x + blobsize
    
        # scroll the text
        img = screenshot()
        e32.ao_yield()
        e32.ao_sleep(delay)
        canvas.blit(img,target=(0,blobsize))
            
    
        #right left change the size of the text
        if keyboard.is_down(EScancodeLeftArrow):  
            canvas.rectangle((0,0,176,blobsize), fill = 0x000000)
            blobsize -= 1
            if blobsize<1:
                blobsize = 1
            
        if keyboard.is_down(EScancodeRightArrow): 
            canvas.rectangle((0,0,176,blobsize), fill = 0x0000)
            blobsize += 1
            
        #up down change speed
        if keyboard.is_down(EScancodeDownArrow):  delay += .01
        if keyboard.is_down(EScancodeUpArrow):    
            delay -= .01
            if delay<0:
                delay = 0
                
        if keyboard.pressed(EScancodeHash):
            filename=u'e:\\screenshot.png'
            canvas.text((0,32),u'Saving screenshot to:',fill=0xffff00)
            canvas.text((0,48),filename,fill=0xffff00)
            img.save(filename)
    
        n_frames+=1
    end_time=time.clock()
    total=end_time-start_time
    
    print "%d frames\n %f seconds\n %f FPS\n %f ms/frame.\n"%(n_frames,total,
                                                         n_frames/total,
                                                         total/n_frames*1000.)
    Last edited by xchip; 2006-05-29 at 21:10.

  2. #2
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: [announce] full screen dot amtrix scroller

    Quote Originally Posted by xchip
    Enjoy! BTW I'm loking forward to hearing your improvements :-)


    [/CODE]
    Cool
    On my Nokia 6600 stats are 0.077 FPS
    Could you add some modifications ?
    - choose scrolling direction (right to left,left to right , up to down , down to up)
    - choose color or use more colors
    - change setting during scrolling

    OK I found size changing feature but I found a bug
    When you lower font character size screen is frozen !
    I push right arrow to make characters bigger and screen scroll again but size changing is not smooth and behavior is weird (size is not correct ! ) It's difficult to have very little characters !
    Last edited by cyke64; 2006-05-29 at 07:12.
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  3. #3
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    Re: [announce] full screen dot amtrix scroller

    Quote Originally Posted by cyke64
    Cool
    On my Nokia 6600 stats are 0.077 FPS
    I fixed the fps counter, I got 30 FPS on my 6610

    Quote Originally Posted by cyke64
    Could you add some modifications ?
    - choose scrolling direction (right to left,left to right , up to down , down to up)
    oops that is going to be tricky, it woudl be easy to add if all the font had the same size, I'lll look into that though

    Quote Originally Posted by cyke64
    - choose color or use more colors
    - change setting during scrolling
    yup, I need to learn how the UI works to add more effects

    Quote Originally Posted by cyke64
    OK I found size changing feature but I found a bug
    When you lower font character size screen is frozen !
    I push right arrow to make characters bigger and screen scroll again but size changing is not smooth and behavior is weird (size is not correct ! ) It's difficult to have very little characters !
    I fixed the frozen characteres, but I didn't see incorrect size problem

    Cool! thanks for testing!

  4. #4
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: [announce] full screen dot amtrix scroller

    hey Raul ,

    Update the link of your scroller app to you site (google pages)


    http://aguaviva.googlepages.com/s60pythondevelopment
    http://aguaviva.googlepages.com/scroller.zip
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  5. #5
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    Re: [announce] full screen dot amtrix scroller

    Quote Originally Posted by cyke64
    hey Raul ,

    Update the link of your scroller app to you site (google pages)


    http://aguaviva.googlepages.com/s60pythondevelopment
    http://aguaviva.googlepages.com/scroller.zip
    err what do you mean?? You wanted me to post the link to my page? :-)

  6. #6
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: [announce] full screen dot amtrix scroller

    Quote Originally Posted by xchip
    err what do you mean?? You wanted me to post the link to my page? :-)
    Yes
    It's better to have a permanent link to an explanation and also a file than copy/paste text to a file !
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  7. #7
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    76

    Re: [announce] full screen dot amtrix scroller

    Cool script! One suggestion though would be to determine the screen size at runtime instead of hardcoding 176x208. This will make the app more scalable for devices with different resolutions (like the E60/E80/N80/N90 and the QVGA phones.) On my N90 the text displays a bit smaller then I think you intended -- though I'm still having fun passing messages in meetings ;-)

  8. #8
    Registered User
    Join Date
    Sep 2005
    Posts
    30

    Re: [announce] full screen dot amtrix scroller

    Quote Originally Posted by eriksmartt
    Cool script! One suggestion though would be to determine the screen size at runtime instead of hardcoding 176x208. This will make the app more scalable for devices with different resolutions (like the E60/E80/N80/N90 and the QVGA phones.) On my N90 the text displays a bit smaller then I think you intended --
    Yep, BTW did you try to change the hardcoded screen size? Was it still running at a decent speed? How many FPS did you get?

    Quote Originally Posted by eriksmartt
    though I'm still having fun passing messages in meetings ;-)
    hehehe :-) Just to hear this comment makes worth the effort of writing the script :-)

Similar Threads

  1. Can't return display to full screen??
    By danparks in forum Symbian User Interface
    Replies: 2
    Last Post: 2005-10-10, 05:32
  2. Full Screen GPRS Connection Icon
    By murid in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-08-25, 22:39
  3. Full screen splash screen
    By jitendrachhajed in forum Symbian
    Replies: 1
    Last Post: 2005-07-11, 08:01
  4. How to activate Full Screen mode on Series 80?
    By anandrenake in forum Symbian User Interface
    Replies: 1
    Last Post: 2005-01-17, 08:47
  5. Pausing/resuming full screen midlet
    By dubick in forum Mobile Java General
    Replies: 0
    Last Post: 2002-11-15, 11:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×