Setting the line thickness

The last and easiest feature that we are going to implement is a simple line thickness selector. As you can see in the following screenshot, we're reusing assets and styles from the previous part, the color palette.

Setting the line thickness

Line width selector

This UI uses yet another RadioButton subclass, unimaginatively named LineWidthButton. Append the following declaration to the paint.kv file:

<LineWidthButton@ColorButton>:
    group: 'line_width'
    on_release: app.canvas_widget.set_line_width(self.text)
    color: C('#2C3E50')
    background_color: C('#ECF0F1')

Key differences from ColorButton are highlighted in the preceding code. These new buttons belong ...

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.