class App(object): def __init__(self, url, interval): self.fetcher = IndexFetcher(url) self.displayer = Displayer() self.interval = interval def repeat_refreshing(self): self.fetcher.refresh() self.display() Timer(self.interval, self.repeat_refreshing).start() def display(self): if self.fetcher.status == Status.success: self.displayer.set_data(self.fetcher.data) def run(self): self.repeat_refreshing()
def __init__(self, url, interval): self.fetcher = IndexFetcher(url) self.displayer = Displayer() self.interval = interval