From 26d536eb55d4fc847a8c83660fa0de7c4b077bf3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 4 Mar 2014 12:34:23 +0100 Subject: add Bar.invalidate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- examples/clock | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'examples/clock') diff --git a/examples/clock b/examples/clock index c7d9ac2..163f7d5 100644 --- a/examples/clock +++ b/examples/clock @@ -17,19 +17,11 @@ clock = Clock(format = '%Y-(%m)%b-%d %T, %a w%V, %Z', utc = False, sync_to = Clo start_ = start def start(): start_() - def refresh(): - if redraw(): - get_display().flush() - async(lambda : clock.continuous_sync(refresh)) + async(lambda : clock.continuous_sync(lambda : bar.invalidate())) -semaphore = threading.Semaphore() def redraw(): - if semaphore.acquire(blocking = False): - text = clock.read() - bar.clear() - bar.draw_coloured_text(0, 10, 0, 2, text) - semaphore.release() - return True - return False + text = clock.read() + bar.clear() + bar.draw_coloured_text(0, 10, 0, 2, text) -- cgit v1.2.3-70-g09d2