File: _web_example6.py

package info (click to toggle)
nodebox-web 1.9.4.6-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,900 kB
  • sloc: python: 7,582; ansic: 581; xml: 239; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 383 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Retrieve images from MorgueFile.

try:
    web = ximport("web")
except:
    web = ximport("__init__")
    reload(web)

q = "cloud"
img = choice(web.morguefile.search(q))

print img

# A morgueFile image in the list has 
# a number of methods and properties.
# The download() method caches the image locally 
# and returns the path to the file.
img = img.download()
image(img, 0, 0)