Super,
the way is open now.
Okay and now I understand, I have to click on </> button.
from scene import *
import sound
import random
import math
A = Action
class ntt(Node):
chr_wdth = 60
def __init__(self, txt):
#self.color = 'black'
rect_path = ui.Path.rect(0, 0, 75, 100)
rect_path.line_width = 1
# the bg_node is a shape node that uses the path to draw the shape
self.ntt_shpnd = ShapeNode(rect_path, 'white', 'black')
self.ntt_lblnd = LabelNode(txt, ('Courier New', 10))
self.ntt_lblnd.color = "red"
self.ntt_lblnd.position = (0, 0)
# add the nodes as children of the card node
self.add_child(self.ntt_shpnd)
self.ntt_shpnd.add_child(self.ntt_lblnd)
def point_inside(self, x, y):
'''Check if the point x, y is within the bounding box'''
return self.bbox.contains_point((x, y))
def update(self):
pass
class MyScene (Scene):
def setup(self):
ntt_1=ntt("hello")
ntt_1.position= self.size/2
self.ntts = []
self.ntts.append(ntt_1)
self.add_child(ntt_1)
def did_change_size(self):
pass
def update(self):
pass
def touch_began(self, touch):
x, y = touch.location
if self.ntts[0].point_inside(x, y):
self.ntts[0].ntt_lblnd.text = "hello back"
#throw_1
self.ntts[0].ntt_shpnd = ShapeNode(self.ntts[0].ntt_shpnd.path, "red","black")
#throw_2
self.ntts[0].ntt_shpnd.fill_color="red"
def touch_moved(self, touch):
pass
def touch_ended(self, touch):
pass
if __name__ == '__main__':
run(MyScene(), show_fps=False)
Yes it works !
Thanks both of you!