Skip to content Skip to sidebar Skip to footer

How Can I Get Ref Text When I Have Many Refs In Kivy Label?

Please help. I have many refs in label and when user click on first ref how can i get ref text on main.py? I need python method which can get this ref text. Label: markup: T

Solution 1:

All the arguments passed to the event handler are available in kv via the args variable. The arguments to the on_ref_press handler are instance, refvalue. So, for example:

Label:markup:Truetext:"[ref=first ref]First ref[/ref] ,[ref=second ref]Second ref[/ref]"on_ref_press:printargs[1]

will cause first ref to be printed when the "First ref" text is clicked, and second ref will be printed when the "Second ref" text is clicked.

Post a Comment for "How Can I Get Ref Text When I Have Many Refs In Kivy Label?"