Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User daturach's Avatar
    Join Date
    Jun 2009
    Posts
    4
    Hello

    I would like to display some background images in full screen. I have assigned a color to each of the menu entries.
    I need to get the menu back using a key. I am using a touch screen (5800).
    Could someone show me how I could do that?

    Thanks in advance for your help.

    W.

    Code:
    import e32,appuifw,graphics  # import modules
    
    BLACK= (0,0,0)
    BLUE= (0,127,255)
    RED= (255,0,0)
    YELLOW= (255,255,0)
    def handle_redraw(rect):
        if img:
            canvas.blit(img)
    appuifw.app.screen='full'
    appuifw.app.orientation='landscape'
    def quit():
        app_lock.signal()
    def menu1():
        appuifw.app.title = u"Black"
        global canvas
        global img
        canvas=appuifw.Canvas(redraw_callback = handle_redraw,event_callback = None)
        img = graphics.Image.new((canvas.size))
        appuifw.app.body=canvas
        img.clear(BLACK)
    def sub1():
        appuifw.app.title = u"Yellow"
        global canvas
        global img
        canvas=appuifw.Canvas(redraw_callback = handle_redraw,event_callback = None)
        img = graphics.Image.new((canvas.size))
        appuifw.app.body=canvas
        img.clear(YELLOW)
    def sub2():
        appuifw.app.title = u"Red"
        global canvas
        global img
        canvas=appuifw.Canvas(redraw_callback = handle_redraw,event_callback = None)
        img = graphics.Image.new((canvas.size))
        appuifw.app.body=canvas
        img.clear(RED)
    def sub3():
        appuifw.app.title = u"Blue"
        global canvas
        global img
        canvas=appuifw.Canvas(redraw_callback = handle_redraw,event_callback = None)
        img = graphics.Image.new((canvas.size))
        img.clear(BLUE)
        appuifw.app.body=canvas
    appuifw.app.exit_key_handler=quit  
    appuifw.app.menu = [(u"Menu1", menu1),
                        (u"Menu2", (((u"Yellow", sub1),
                        				(u"Red", sub2),
                                        (u"Blue", sub3))))]
    app_lock=e32.Ao_lock()
    app_lock.wait()

  2. #2
    Nokia Developer Champion marcelobarrosalmeida's Avatar
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    752
    Hi daturach,

    You didn´t tell exactly what is not working but I could see that you did not put the global inside redraw handler:

    Code:
    def handle_redraw(rect):
        global img
        global canvas
        if img:
            canvas.blit(img)

  3. #3
    Registered User daturach's Avatar
    Join Date
    Jun 2009
    Posts
    4
    In landscape full mode, the menus are not visible on the screen.
    As I said, I would like to make them visible using a key.

    Is that possible and if yes, could someone tell me how to do this?

    Thanks

  4. #4
    Nokia Developer Champion marcelobarrosalmeida's Avatar
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    752
    Quote Originally Posted by daturach View Post
    In landscape full mode, the menus are not visible on the screen.
    As I said, I would like to make them visible using a key.

    Is that possible and if yes, could someone tell me how to do this?
    No, menus are not visible in full screen for touch devices. And we do not have any key, so it is better to think in a strategy using the touch area.

  5. #5
    Registered User daturach's Avatar
    Join Date
    Jun 2009
    Posts
    4
    I am thinking about using a toolbar ...
    I have installed your scripts (http://wiki.forum.nokia.com/index.ph...ch_S60_devices ) in the 5th Edition emulator, running Python 1.4.5. I don't get any error messages while running them. However, I am wondering if it is only supposed to work on a mobile phone (not yet installed). For example, I can't move the toolbar.

    Question: Which Python version do I have to install or is 1.4.5 ok ?
    Thanks
    W.

  6. #6
    Nokia Developer Champion marcelobarrosalmeida's Avatar
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    752
    Quote Originally Posted by daturach View Post
    For example, I can't move the toolbar.
    Question: Which Python version do I have to install or is 1.4.5 ok ?
    .
    I tested only in 1.9.x, since I am using XM 5800. The toolbar does not move by itself. I implemented the moving as a demo feature for touch devices. The toolbar only show images and control them, calling a callback function when some image is selected. Please, see the code to understand how you could implement the moving.

  7. #7
    Registered User daturach's Avatar
    Join Date
    Jun 2009
    Posts
    4
    I have updated my emulator from Python 1.4.5 to 1.9.6 and played around with the ToolbarDemo script. Everything seems to work...
    I can move, show, hide, etc.

    However, the below script does not work anymore.

    I can select a color the first time I click on any menu item. If I click a second time, it does not work.

    I got the following error:

    Python: System error (-50)

    Traceback (most recent call last):
    File "c:\data\python\stats_skeleton.py", line 26, in sub1 canvas=appuifw.Canvas
    (redraw_callback = handle_redraw,event_callback = None)
    File "c:\resource\python25\python25.zip\appuifw.py", line 19, in __init__
    SymbianError: [Errno - 858993460] Error -858993460

    Could someone help?

    Thanks

    W.

    Code:
    import e32,appuifw,graphics  # import modules
    
    BLACK= (0,0,0)
    BLUE= (0,127,255)
    RED= (255,0,0)
    YELLOW= (255,255,0)
    def handle_redraw(rect):
        if img:
            canvas.blit(img)
    appuifw.app.screen='normal'
    appuifw.app.orientation='portrait'
    def quit():
        app_lock.signal()
    def menu1():
        appuifw.app.title = u"Black"
        global canvas
        global img
        canvas=appuifw.Canvas(redraw_callback = handle_redraw,event_callback = None)
        img = graphics.Image.new((canvas.size))
        appuifw.app.body=canvas
        img.clear(BLACK)
    def sub1():
        appuifw.app.title = u"Yellow"
        global canvas
        global img
        canvas=appuifw.Canvas(redraw_callback = handle_redraw,event_callback = None)
        img = graphics.Image.new((canvas.size))
        appuifw.app.body=canvas
        img.clear(YELLOW)
    def sub2():
        appuifw.app.title = u"Red"
        global canvas
        global img
        canvas=appuifw.Canvas(redraw_callback = handle_redraw,event_callback = None)
        img = graphics.Image.new((canvas.size))
        appuifw.app.body=canvas
        img.clear(RED)
    def sub3():
        appuifw.app.title = u"Blue"
        global canvas
        global img
        canvas=appuifw.Canvas(redraw_callback = handle_redraw,event_callback = None)
        img = graphics.Image.new((canvas.size))
        img.clear(BLUE)
        appuifw.app.body=canvas
    appuifw.app.exit_key_handler=quit  
    appuifw.app.menu = [(u"Menu1", menu1),
                        (u"Menu2", (((u"Yellow", sub1),
                        				(u"Red", sub2),
                                        (u"Blue", sub3))))]
    app_lock=e32.Ao_lock()
    app_lock.wait()

Similar Threads

  1. SMS Composer + Key Events
    By aneville in forum Python
    Replies: 4
    Last Post: 2009-04-28, 17:57
  2. right soft key to exit on full-screen canvas
    By Larry101 in forum Mobile Java General
    Replies: 5
    Last Post: 2008-02-21, 11:44
  3. Catching key events of a Text type
    By bercobeute in forum Python
    Replies: 8
    Last Post: 2006-04-21, 17:34
  4. Replies: 1
    Last Post: 2004-06-28, 09:57
  5. Replies: 1
    Last Post: 2003-08-25, 11:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved