Dugan Chen's Homepage

Various Things

Using PyQt4 to download images from Last.fm

2011-12-5

The following is code that I’m planning to roll almost directly into Quetzalcoatl. It asynchronously downloads an image from Last.fm and loads it into a widget. The image then scales with its containing widget, using maximum amount of space while keeping its aspect ratio.

Keep in mind that it’s example code, not production code, and thus doesn’t have the requisite error checking (for example, it doesn’t check if a directory exists before creating it).