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 widget has full control over its placement and size (this is pretty much the default state of affairs in many other UI toolkits, such as Delphi, Visual Basic, and so on).
To position the newly created delete button in the top-right corner, we do the...