Taking a Screenshot
The view that is visible on the phone’s screen can be captured with thefunction graphics.screenshot(). This function converts the current
view to a new Image object and returns it to the caller. Example 32 takes
a screenshot of itself and saves it to a file.
Example 32: Screenshot
import graphics
print "Hi there!"
img = graphics.screenshot()
img.save(u"e:\\Images\\screenshot.png")
Note that if you have a new memory card, it might not have the Images
directory. In this case, use the phone’s default camera application to
shoot and save a photo to the memory card. This will create the required
directory.
Screenshots that appear in this book were taken as follows: we used the
e32.Ao timer object to call a function after a certain time period – see
Example 50 for a similar usage of the timer. The function contained the
same lines as the example above. For each figure, we calibrated the delay
so that the screen would contain the exact arrangement we wanted to
capture.
No comments:
Post a Comment