Label with selectable text

138 views
Skip to first unread message

Ivan Sonnov

unread,
Apr 16, 2015, 6:04:00 PM4/16/15
to kivy-...@googlegroups.com
i'm trying to create chatbox on kivy python. one of the most difficult is to create class with super class Label, which can support select its text like a TextInput class. Can somebody help me?

Alexander Taylor

unread,
Apr 17, 2015, 1:11:21 PM4/17/15
to kivy-...@googlegroups.com
It will be hard to support this - to do it properly, you probably want to look at how TextInput implements it. An alternative would be to actually use a TextInput but disable most interaction.
Message has been deleted

Ivan Sonnov

unread,
Apr 17, 2015, 1:50:26 PM4/17/15
to kivy-...@googlegroups.com

i've already thougth about it, but i have some troubles, for example i don't know how to change textinput heigth in dependence of text size or to do rounded corners of textinput widget, i need to do textinput view like a label on the picture

пятница, 17 апреля 2015 г., 20:11:21 UTC+3 пользователь Alexander Taylor написал:

Anders Högqvist

unread,
Apr 20, 2015, 12:34:02 PM4/20/15
to kivy-...@googlegroups.com
Why does it have to be a Label subclass? I think it would be easer to subclass TextInput and make it "read only", than subclass Label and incorporate all the selecting selecting things.

To adjust height according to the amount of text I would try using something like height=self.texture_size[1]

To have rounded corners, make a png image with a rounded rectangle in a color of choice, then use it as a BorderImage. Check the kivy/data/style.kv file to see how they use it in the original theme.
Reply all
Reply to author
Forward
0 new messages