Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Kivy Blueprints

You're reading from   Kivy Blueprints Build your very own app-store-ready, multi-touch games and applications with Kivy!

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher Packt
ISBN-13 9781783987849
Length 282 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

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 to another radio group and fire another event handler when interacted with. Other than this, they are very similar.

The layout is equally simple, built in the same fashion as that of the color palette, except that it's vertical:

BoxLayout:
    orientation: 'vertical'
    padding...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image