How draw dotted outline around kivy widget

32 views
Skip to first unread message

Degenerate Tech

unread,
May 10, 2024, 9:06:45 AM5/10/24
to Kivy users support
i want draw dotted line or dashed line around kivy label . how to do ?

Degenerate Tech

unread,
May 10, 2024, 9:28:57 AM5/10/24
to Kivy users support
i want dashed line around rounded label of radius dp(30) how to implament that ?

elli...@cox.net

unread,
May 10, 2024, 10:00:24 AM5/10/24
to Kivy users support
Here you go:

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.properties import ColorProperty

kv = """
<RoundedRectangleLabel>:
   canvas:
       Color:
           rgba: self.outline_color
       Line:
           dash_offset: 5
           dash_length: 5
           rounded_rectangle: (*self.pos, *self.size, dp(30))  # (x, y, width, height, corner_radius)

AnchorLayout:
   RoundedRectangleLabel:
       size_hint: None, None
       size: dp(150), dp(48)
       text: 'Hello'
       outline_color: 'yellow'
"""


class RoundedRectangleLabel(Label):
   outline_color = ColorProperty()


class DemoRoundedRectLabel(App):
   def build(self):
       return Builder.load_string(kv)


DemoRoundedRectLabel().run()


From: kivy-...@googlegroups.com <kivy-...@googlegroups.com> on behalf of Degenerate Tech <sksah...@gmail.com>
Sent: Friday, May 10, 2024 6:28 AM
To: Kivy users support <kivy-...@googlegroups.com>
Subject: [kivy-users] Re: How draw dotted outline around kivy widget
 
i want dashed line around rounded label of radius dp(30) how to implament that ?

On Friday, May 10, 2024 at 6:36:45 PM UTC+5:30 Degenerate Tech wrote:
i want draw dotted line or dashed line around kivy label . how to do ?

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/6ac0f7a7-cfe0-4ff5-970b-61050e1e76ebn%40googlegroups.com.

Degenerate Tech

unread,
May 10, 2024, 10:26:06 AM5/10/24
to Kivy users support
thx.
Reply all
Reply to author
Forward
0 new messages