Clearing the screen

Right now, the only way to clear the screen in our little app is to restart it. Let's add a button for deleting everything from the canvas to our UI, which is very minimalistic at the moment. We'll reuse the button look from the previous app, so there will be nothing new about theming; the interesting part here is positioning.

In our first program, the Clock app from Chapter 1, Building a Clock App, we didn't work on any explicit positioning at all, as everything was being held in place by nested BoxLayouts. Now, however, we don't have any layout to our program as the root widget is our very own CanvasWidget, and we didn't implement any logic to position its children.

In Kivy, the absence of an explicit layout means that every ...

Get Kivy Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.