- Kivy Tutorial
- Kivy - Home
- Kivy Basics
- Kivy - Getting Started
- Kivy - Installation
- Kivy - Architecture
- Kivy - File Syntax
- Kivy - Applications
- Kivy - Hello World
- Kivy - App Life Cycle
- Kivy - Events
- Kivy - Properties
- Kivy - Inputs
- Kivy - Behaviors
- Kivy Buttons
- Kivy - Buttons
- Kivy - Button Events
- Kivy - Button Colors
- Kivy - Button Size
- Kivy - Button Position
- Kivy - Round Buttons
- Kivy - Disabled Buttons
- Kivy - Image Button
- Kivy Widgets
- Kivy - Widgets
- Kivy - Label
- Kivy - Text Input
- Kivy - Canvas
- Kivy - Line
- Kivy - Checkbox
- Kivy - Dropdown List
- Kivy - Windows
- Kivy - ScrollView
- Kivy - Carousel
- Kivy - Slider
- Kivy - Images
- Kivy - Popup
- Kivy - Switch
- Kivy - Spinner
- Kivy - Splitter
- Kivy - Progress Bar
- Kivy - Bubble
- Kivy - Tabbed Panel
- Kivy - Scatter
- Kivy - Accordion
- Kivy - File Chooser
- Kivy - Color Picker
- Kivy - Code Input
- Kivy - Modal View
- Kivy - Toggle Button
- Kivy - Camera
- Kivy - Tree View
- Kivy - reStructuredText
- Kivy - Action Bar
- Kivy - Video Player
- Kivy - Stencil View
- Kivy - VKeyboard
- Kivy - Touch Ripple
- Kivy - Audio
- Kivy - Videos
- Kivy - Spelling
- Kivy - Effects
- Kivy - Input Recorder
- Kivy - OpenGL
- Kivy - Text
- Kivy - Text Markup
- Kivy - Settings
- Kivy Layouts
- Kivy - Layouts
- Kivy - Float Layout
- Kivy - Grid Layouts
- Kivy - Box Layouts
- Kivy - Stack Layout
- Kivy - Anchor Layout
- Kivy - Relative Layout
- Kivy - Page Layout
- Kivy - Recycle Layout
- Kivy - Layouts in Layouts
- Kivy Advanced Concepts
- Kivy - Configuration Object
- Kivy - Atlas
- Kivy - Data Loader
- Kivy - Cache Manager
- Kivy - Console
- Kivy - Animation
- Kivy - Multistroke
- Kivy - Clock
- Kivy - SVGs
- Kivy - UrlRequest
- Kivy - Clipboard
- Kivy - Factory
- Kivy - Gesture
- Kivy - Language
- Kivy - Graphics
- Kivy - Drawing
- Kivy - Packaging
- Kivy - Garden
- Kivy - Storage
- Kivy - Vector
- Kivy - Utils
- Kivy - Inspector
- Kivy - Tools
- Kivy - Logger
- Kivy - Framebuffer
- Kivy Applications and Projects
- Kivy - Drawing App
- Kivy - Calculator App
- Kivy - Stopwatch App
- Kivy - Camera Handling
- Kivy - Image Viewer
- Kivy - Bezier
- Kivy - Canvas Stress
- Kivy - Circle Drawing
- Kivy - Widget Animation
- Kivy - Miscellaneous
- Kivy Useful Resources
- Kivy - Quick Guide
- Kivy - Useful Resources
- Kivy - Discussion
Kivy - Text Markup
Although Kivy's Label object has properties such as bold, italics and color, etc., it also provides markup facility to decorate the label text using a syntax similar to HTML tags. For the markup to show effect, you need to set the markup property of the label to True.
l = Label(text='Hello [b]World[/b]', markup=True)
Note that the kivy markup can be used only for inline styling. Instead of the tags with angular brackets as in HTML (as <b>Hello</b>), square brackets are used here (example: [b]Hello</b])
The text with this markup syntax is very much similar to the HTML syntax, as the following table shows −
HTML | Kivy Markup |
---|---|
<b>bolded text</b> | [b]bolded text[/b] |
<i>italicized text</i> | [i]italicized text[/i] |
<u>underlined text</u> | [u]underlined text[/u] |
The following tags can be used for inline styling of the text property of label widget −
Sr.No | Text Property & Description |
---|---|
1 | [b][/b] Activate bold text |
2 | [i][/i] Activate italic text |
3 | [u][/u] Underlined text |
4 | [s][/s] Strikethrough text |
5 | [font=<str>][/font] Change the font (str should be name of TTF file) |
6 | [font_family=<str>][/font_family] Font family to request for drawing. |
7 | [size=<size>][/size] Change the font size. <size> should be an integer. |
8 | [color=#<color>][/color] Change the text color |
9 | [anchor=<str>] Put an anchor in the text. |
10 | [sub][/sub] Display the text at a subscript position relative to the text before it. |
11 | [sup][/sup] Display the text at a superscript position relative to the text before it. |
If you need to escape the markup from the current text, use kivy.utils.escape_markup().
To Continue Learning Please Login
Login with Google