KivyMD
KivyMD copied to clipboard
Need for a selectable "Label"
Description of the Feature
There is a need to make a Label whose contents can be copied, selected etc, by the user. For, an example, I am building a simple app that finds the meaning of the word and prints the message via Label so that it can be properly formatted using Heading etc. But the user cannot select the text! It is like this rigid entity and not normal at all. I am aware that I will be told to use MDTextField with Read-Only option but Label with proper formatting looks far better than MDTextField. So, I suggest a middle ground between the two and a Label which produces text which is selectable- Selectable Label. Even Flutter has a separate widget-SelectableText-class-link= https://api.flutter.dev/flutter/material/SelectableText-class.html
why not add touch behavior to a custom class inheriting mdlabel
i'm not sure if kivy has a provider for that, i mean, externally of a text input widget. Since every OS has a provider for that functionality
It is possible but you have to do a trick.
Use text input with focus : 'False'
This will not allow user to enter anything.
Set your own text to display with text : 'blah! blah!
But there is a problem that keyboard comes up just for a moment. It can be managed by overriding on_focus
method.
Why this works
focus
is a Boolean Property but when we pass it a String Value, its behaviour to focus crashes. So now you can use your TextInput for everything instead of typing into it.