O'Reilly logo

Kivy: Interactive Applications in Python by Roberto Ulloa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Images, colors, and backgrounds

In this section, we will learn how to add images and colors to shapes and how to position graphics at a front or back level . We continue using the same Python code of the first section: python drawing.py --size=400x100. The following screenshot (Images and colors) shows the final result of this section:

Images, colors, and backgrounds

Images and colors

The following is the corresponding drawing.kv code:

64. # File name: drawing.kv (Images and colors) 65. <DrawingSpace>: 66. canvas: 67. Ellipse: 68. pos: 10,10 69. size: 80,80 70. source: 'kivy.png' 71. Rectangle: 72. pos: 110,10 73. size: 80,80 74. source: 'kivy.png' 75. Color: 76. rgba: 0,0,1,.75 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required