Advanced text manipulation

Text is one of the most commonly used contents used in the apps. The recipe will create an app with a label widget where we will use text rendering to make our Hello World.

How to do it…

We are going to use one simple Python files that will just show our Hello World text. To complete the recipe:

  1. Import the usual kivy packages.
  2. Also, import the label package.
  3. Define the e9app class instanced as app.
  4. Define the method build() to the class.
  5. Return the label widget with our Hello World text.
    import kivy kivy.require('1.9.0') # Code tested in this version! from kivy.app import App from kivy.uix.label import Label class e9App(App): def build(self): return Label(text='Hello [ref=world][color=0000ff]World[/color][/ref]', markup=True, ...

Get Kivy Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.