# ui View for the top ten iTunes songs.
# This code only seems to run half the time.  Pull requests gladly accepted.

# coding: utf-8

import feedparser, ui

url = 'https://itunes.apple.com/us/rss/topsongs/limit=10/xml'

def get_image_urls(itunes_url):
    for entry in feedparser.parse(itunes_url).entries:
         yield entry['summary'].partition('src="')[2].partition('"')[0]

class TopTenView(ui.View):
    def __init__(self, image_urls):
        self.present()
        for i, url in enumerate(image_urls):
            image_view = ui.ImageView()
            image_view.load_from_url(url)
            self.add_subview(image_view)
            image_view.x = (i % 5) * 128 + 10
            image_view.y = (i / 5) * 128 + 10

TopTenView(get_image_urls(url))

@@ -1,89 +1,71 @@
 # 
-ui View for the top ten iTunes songs.%0A# This code only seems to run half the time. 
+coding: utf-8%0A%0A# ui.View subclass for the top ten iTunes songs.%0A#
  Pul
@@ -93,33 +93,16 @@
 epted.%0A%0A
-# coding: utf-8%0A%0A
 import f
@@ -111,16 +111,26 @@
 dparser,
+ requests,
  ui%0A%0Aurl
@@ -284,17 +284,16 @@
         
- 
 yield en
@@ -495,118 +495,148 @@
     
-image_view = ui.ImageView()%0A            image_view.load_from_url(url)%0A            self.add_subview(image_view)
+button = ui.Button()%0A            button.background_image = ui.Image.from_data(requests.get(url).content)%0A            button.border_width = 2
 %0A   
@@ -644,26 +644,22 @@
         
-image_view
+button
 .x = (i 
@@ -690,18 +690,14 @@
     
-image_view
+button
 .y =
@@ -715,16 +715,100 @@
 128 + 10
+%0A            button.width = button.height = 128%0A            self.add_subview(button)
 %0A%0ATopTen
@@ -812,16 +812,21 @@
 TenView(
+list(
 get_imag
@@ -837,9 +837,10 @@
 ls(url))
+)
 %0A

Move to buttons