| Reply | « Previous Thread | Next Thread » |
|
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 15:00.
|
| JimmPooJimmPoo |
| View Public Profile |
| Find all posts by JimmPooJimmPoo |
![]() nobody an Idea? I only want to show a *.gif image in python... |
| JimmPooJimmPoo |
| View Public Profile |
| Find all posts by JimmPooJimmPoo |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
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. |
|
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()
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? |
| JimmPooJimmPoo |
| View Public Profile |
| Find all posts by JimmPooJimmPoo |
|
Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Rafael T.
Offline
Forum Nokia Champion
|
|
|
Quote:
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. |
|
Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Rafael T.
Offline
Forum Nokia Champion
|
|
|
Quote:
![]() 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. |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Please help installing Python libraries on S60 | ericroijen | Python | 11 | 2009-07-18 11:43 |
| New to Python for S60 (PyS60)? Read this first! | croozeus | Python | 2 | 2008-10-17 20:23 |
| [announce] the first Mobile Python book is now available ! | cyke64 | Python | 1 | 2008-01-08 10:58 |
| [announce] Mobile Python book soon in Sept 2007 ! | cyke64 | Python | 11 | 2007-10-03 20:46 |
| Animated GIF for MMS Specifications | handtap | General Messaging | 2 | 2003-08-22 10:46 |