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:
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 77. Line: 78. points: 10,10,390,10 79. width: 10 80. cap: 'square' 81. Color: 82. rgba: 0,1,0,1 83. Rectangle: 84. pos: 210,10 85. size: 80,80 86. source: 'kivy.png' 87. Rectangle: 88. pos: 310,10 89. size: 80,80
This...