Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User JimmPooJimmPoo's Avatar
    Join Date
    Sep 2008
    Posts
    21
    Hi,

    I wrote my first app: nCoin v0.57
    nCoin is an App that can toss a coin for something.

    so here are my questions:

    1.
    Is it possible to show an animated img while the coin is "spinning" in the phone?

    2.
    how to flip the coin through pressing the Joistick?


    Try it:
    Download:
    http://www.mediafire.com/?dmyhw0y4aws

    - Latest Python and megapymodulepack must be installed.
    - This is unsigned so you must self-sign or have a hacked phone.
    Last edited by JimmPooJimmPoo; 2008-10-28 at 14:00.

  2. #2
    Registered User JimmPooJimmPoo's Avatar
    Join Date
    Sep 2008
    Posts
    21


    nobody an Idea?

    I only want to show a *.gif image in python...

  3. #3
    Nokia Developer Moderator bogdan.galiceanu's Avatar
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471
    1) As far as I know it isn't possible to display animated gif files (you can only display the first frame of it). So maybe you can have a few different images and display them in a fast sequence so it would look like the coin is spinning.

    2) You can bind the joystick (selection) button to the canvas so that when it's pressed, call a function that "flips" the coin.

  4. #4
    Registered User JimmPooJimmPoo's Avatar
    Join Date
    Sep 2008
    Posts
    21
    thx for ur reply
    so u mean extract the gif images to a few different images?
    and then? i used this code to show one image:

    Code:
    scr=topwindow.TopWindow()
    inf=graphics.Image.open("Path to file...")
    scr.add_image(inf,(0,0,240,320))
    scr.show()
    but when I add this a again to view a second img,
    for a little second, the background image of my app is shown.
    there is no smoothly transition of the images...

    u know a better code, to view a few images in fast sequence?

  5. #5
    Super Contributor Rafael T.'s Avatar
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744
    Quote Originally Posted by JimmPooJimmPoo View Post
    Hi,

    I wrote my first app: nCoin v0.57
    nCoin is an App that can toss a coin for something.

    so here are my questions:

    1.
    Is it possible to show an animated img while the coin is "spinning" in the phone?

    2.
    how to flip the coin through pressing the Joistick?

    I just tested a script with an animated .gif and it didn't worked. The image stays still. But, as Bogdan said, you can display them in sequence so it will look like a spin.


    To call the function for flipping the coin, you can use canvas.bind, as Bogdan also told you. For example:

    Code:
    import e32, appuifw, graphics
    import key_codes
    
    path = 'E:\\Python\\comeback.gif'
    img = graphics.Image.open(path)
    
    def coin_flip():
    
        # handle the flip here ...
    
    def handle_redraw(rect):
        canvas.blit(img)
    
    canvas = appuifw.Canvas(event_callback = None, redraw_callback = handle_redraw)
    appuifw.app.body = canvas
    appuifw.app.body = 'full'
    
    canvas.bind(key_codes.EKeySelect, coin_flip)
    
    app_lock = e32.Ao_lock()
    app_lock.wait()

    Hope it helps,

    Rafael.

  6. #6
    Super Contributor Rafael T.'s Avatar
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744
    Quote Originally Posted by JimmPooJimmPoo View Post
    thx for ur reply
    so u mean extract the gif images to a few different images?
    and then? i used this code to show one image:

    Code:
    scr=topwindow.TopWindow()
    inf=graphics.Image.open("Path to file...")
    scr.add_image(inf,(0,0,240,320))
    scr.show()
    but when I add this a again to view a second img,
    for a little second, the background image of my app is shown.
    there is no smoothly transition of the images...

    u know a better code, to view a few images in fast sequence?
    Sorry for the old reply below, we posted almost at the same time

    I'm curious about something:

    Why are you using topwindow module? This code you passed us is displaying the image in the whole screen. For this, you can simplify and use appuifw.Canvas()

    For the animation being smooth, I recommend you to do many images and change them just a little bit at a time so it won't do any "rude" movement

    So, take a look at the code I provided you on the post below. It uses the appuifw.Canvas(). I recommend you to use this because you'll avoid things like displaying the background when changing the images of your animation, as you will draw directly on the application's background


    Hope it helps,

    Rafael.

Similar Threads

  1. Please help installing Python libraries on S60
    By ericroijen in forum Python
    Replies: 11
    Last Post: 2009-07-18, 10:43
  2. Replies: 2
    Last Post: 2008-10-17, 19:23
  3. Replies: 1
    Last Post: 2008-01-08, 09:58
  4. Replies: 11
    Last Post: 2007-10-03, 19:46
  5. Animated GIF for MMS Specifications
    By handtap in forum General Messaging
    Replies: 2
    Last Post: 2003-08-22, 09:46

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