开发者

Nodebox Python clean up

开发者 https://www.devze.com 2023-02-10 13:37 出处:网络
So I tried running an example Nodebox tutorial. Here\'s the code: g = grid.create(2, 2, 250, 250) g.top.left.split(2, 2)

So I tried running an example Nodebox tutorial.

Here's the code:

g = grid.create(2, 2, 250, 250)
g.top.left.split(2, 2)
g.top.left.bottom.right.split(2, 2)
 
# fetch images from Morguefile.com
web = ximport("web")
img = web.morguefile.search("ocean")[:5]
img = [x.download() for x in img]
g.content = images
g.content.repeat = True
 
g.styles.margin = 1
g.styles.fit = True
g.styles.align = "center", "bottom"

Which basically downloads from a site called morguefile. I played with it and tried flickr, which also works. I tried google and youtube, but neither worked. When I changed back to flickr, I started getting errors like:

A开发者_运维百科ttributeError: 'module' object has no attribute 'youtube'

But that is not part of my code anymore! I suspect that my pythonpath could be wrong. I once had a similar problem and restarted my Mac and than it worked again.

If there is no solution, how can I start from scratch?


From what I can gather about the library, web defined Yahoo, morgueFile etc. They did not include youtube + google.

Web is a module; the module has methods and attributed hard-coded in. You can't just cut and copy out websites into the attribute and expect it to work. I'm pretty sure the reason they're hard-coded in is because you can use these websites to search images (probably through their respective APIs) and then download them.

I have no idea what you're trying to do, but I recommend reading the documentation and possibly reading up on python some more.

At any rate, unless you post your actual code, I can't really help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号