Fixed texture example bug with finding texture

This commit is contained in:
Alexander Taylor 2014-07-30 22:23:36 +01:00
parent 1aac389b53
commit 8fc1c193ed
1 changed files with 9 additions and 7 deletions

View File

@ -18,18 +18,18 @@ class TextureAccessibleWidget(Widget):
def __init__(self, **kwargs):
super(TextureAccessibleWidget, self).__init__(**kwargs)
print 'children', self.canvas.children
# self.texture = self.canvas.children[-1].texture
# self.texture.wrap = 'repeat'
Clock.schedule_once(self.texture_init, 0)
def update(self, dt):
tcs = self.tex_coords
for i in range(0, 8, 2):
self.tex_coords[i] += dt/3.
def texture_init(self, *args):
self.texture = self.canvas.children[-1].texture
def on_texture_wrap(self, instance, value):
self.texture.wrap = value
root = Builder.load_string('''
<TextureAccessibleWidget>:
on_touch_down: print self.canvas.children
canvas:
Rectangle:
pos: self.pos
@ -90,10 +90,12 @@ BoxLayout:
text: 'size'
text_size: self.size
halign: 'right'
valign: 'middle'
Label:
text: 'tex_coords'
text_size: self.size
halign: 'left'
valign: 'middle'
BoxLayout:
orientation: 'vertical'
SliderWithValue: