+ 4

How to down the canvas without naming it

I want to make all of the rectangles get down, but its impossble to name them, someone can help me? https://code.sololearn.com/ckrn4Q5wGFNu/?ref=app

8th Dec 2018, 5:26 PM
I Am Arthur
I Am Arthur - avatar
15 ответов
8th Dec 2018, 5:57 PM
I Am Arthur
I Am Arthur - avatar
+ 4
PyDan i know this, i want like, after 5 secs all the canvas that was made change their position
9th Dec 2018, 1:56 PM
I Am Arthur
I Am Arthur - avatar
12th Dec 2018, 11:53 AM
I Am Arthur
I Am Arthur - avatar
+ 3
PyDan Yeah, but what about changing their position instead of deleting them, is it possible?
9th Dec 2018, 8:17 PM
I Am Arthur
I Am Arthur - avatar
+ 3
PyDan https://code.sololearn.com/cQh6Z60cHyAz/?ref=app Take a look at line 56, why it doesn't work?
10th Dec 2018, 12:00 AM
I Am Arthur
I Am Arthur - avatar
+ 3
PyDan Their position didn't change
10th Dec 2018, 4:39 AM
I Am Arthur
I Am Arthur - avatar
+ 2
Can you specify what is the real problem? What you want obtain? Its hard understand your problem without futher info
8th Dec 2018, 11:15 PM
KrOW
KrOW - avatar
9th Dec 2018, 2:30 PM
danvetio
danvetio - avatar
+ 1
I Am Not Arthur Yes, it is Example, Assuming "canvas" move right, we have x_pos +1 if x_pos >= parent.width: x_pos *= -1 => This is help "canvas" moving reverse (move left).
9th Dec 2018, 10:05 PM
danvetio
danvetio - avatar
+ 1
Its still work
10th Dec 2018, 3:59 AM
danvetio
danvetio - avatar
12th Dec 2018, 11:17 AM
danvetio
danvetio - avatar
+ 1
But do you want move multiple rects (not widget) without store all refs? If yes, you can store the rects in an array and modify when you have to update they, the pos attribute. See here for an example https://code.sololearn.com/cNCdOt9Z6A07/?ref=app
12th Dec 2018, 3:49 PM
KrOW
KrOW - avatar
9th Dec 2018, 6:08 AM
danvetio
danvetio - avatar
0
To Change properties of canvas with widget.canvas: Rectangle( size=..., pos=(x, y_pos) # SEE HERE: y_pos ) When you call Clock, y_pos will change its value Move up: y_pos += 5 Move down: y_pos -= 5
9th Dec 2018, 6:18 AM
danvetio
danvetio - avatar
0
It cannot work. class Janela(FloatLayout): Y=0 def __init__(self, **kwargs): super().__init__(**kwargs) with self.canvas: Rectangle(size=(50,50), pos=(100, self.Y)) Clock.schedule_interval(self.update, 1/60) def update(self, *args): self.Y += 0.01
12th Dec 2018, 1:37 PM
danvetio
danvetio - avatar