Python tkinter moving object in def that as been created in another def
<p>I am creating flappy bird style game. And my problem is that i cant move tubes that has been created on another def.
My code is</p>

<pre><code>from tkinter import *
from random import randint
window = Tk()
c = Canvas(window, width=800, height=800, bg='steelblue')
tube11 = randint(600, 650)
tube12 = randint(400, 700)
def createtubes():
    tube1 = c.create_rectangle(800, 800, tube11, tube12, fill='green')
    tube2 = c.create_rectangle(800, 0, tube11, 200, fill='green')   
def automovement():
    if True:
        c.move(tube1, -3.5, 0)
        c.move(tube2, -3.5, 0)
    window.update_idletasks()
    window.after(10, automovement)
window.after(60, createtubes)
window.after(10, automovement)
c.pack()
window.mainloop()
</code></pre>

<p>You can also use tags option on your rectangles.</p>

<pre><code>tube1 = c.create_rectangle(800, 800, tube11, tube12, fill='green', tags='tube')
tube2 = c.create_rectangle(800, 0, tube11, 200, fill='green', tags='tube')
</code></pre>

<p>And in your function only one move :</p>

<pre><code>c.move('tube', -3.5, 0)
</code></pre>

python python-3.x tkinter