/usr/share/kivy-examples/canvas/repeat_texture.py is in python-kivy-examples 1.9.0-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | '''
Repeat Texture on Resize
========================
This examples repeats the letter 'K' (mtexture1.png) 64 times in a window.
You should see 8 rows and 8 columns of white K letters, along a label
showing the current size. As you resize the window, it stays an 8x8.
This example includes a label with a colored background.
Note the image mtexture1.png is a white 'K' on a transparent background, which
makes it hard to see.
'''
from kivy.app import App
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.properties import ObjectProperty, ListProperty
from kivy.lang import Builder
kv = '''
<LabelOnBackground>:
canvas.before:
Color:
rgb: self.background
Rectangle:
pos: self.pos
size: self.size
FloatLayout:
canvas.before:
Color:
rgb: 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
texture: app.texture
LabelOnBackground:
text: '{} (try to resize the window)'.format(root.size)
color: (0.4, 1, 1, 1)
background: (.3, .3, .3)
pos_hint: {'center_x': .5, 'center_y': .5 }
size_hint: None, None
height: 30
width: 250
'''
class LabelOnBackground(Label):
background = ListProperty((0.2, 0.2, 0.2))
class RepeatTexture(App):
texture = ObjectProperty()
def build(self):
self.texture = Image(source='mtexture1.png').texture
self.texture.wrap = 'repeat'
self.texture.uvsize = (8, 8)
return Builder.load_string(kv)
RepeatTexture().run()
|