| Reply | « Previous Thread | Next Thread » |
|
I learned of this function reading the API reference pdf. From what I understood, all I had to do was create a function and call e32.callgate passing it as an argument. That would execute the function as an active object in the thread. Here is my code:
Code:
import graphics
import e32
def snap():
img = graphics.screenshot()
img.save('e:\\photo.png', compression='fast')
fun = e32.ao_callgate(snap)
Ok, what is e32.callgate and how does it work? Thanks in advance! |
|
Calling fun() worked for me. Specifically, this script saved a screenshot:
Code:
import graphics
import e32
def snap():
img = graphics.screenshot()
img.save('e:\\photo.png', compression='fast')
fun = e32.ao_callgate(snap)
fun()
The callgate is activated whenever the thread that owns the callgate runs the Active Scheduler. The Python for S60 libraries usually run the Active Scheduler whenever they are waiting for something. For example, Ao_lock's wait method, socket's recv method and e32.ao_sleep all run the Active Scheduler when they wait. For those who are familiar with Symbian active objects, the ao_callgate is simply an active object that has a queue of calls and that runs all the calls in the queue in its RunL method. |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |