title: Objects do not "spawn" - tkinter
body: <p>I have this game where you have to &quot;pop&quot; Bubbles (Bubs), but they do not spawn. Does someone know why?
  The Bubs should spawn in <code>spawn_bub()</code>, They should spawn at the left side of the screen. The size and future speed as well as the exact location are supposed to be random. The movement will be coded later.</p>
  <pre><code>from typing import Any
  
  from tkinter import *
  from time import sleep, time
  from random import randint
  
  SPEED = 10
  
  bub_id=list()
  bub_rad=list()
  bub_speed=list()
  MIN_BUB_RAD = 10
  MAX_BUB_RAD = 30
  MAX_BUB_SPEED = 10
  GAP = 100
  
  def create_window(color, title, height, width):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2
      HEIGHT = height
      WIDTH  = width
      window = Tk()
      window.title(title)
      c = Canvas (window, width=WIDTH, height=HEIGHT, bg=color)
      c.pack()
  
  def create_ship(color1, color2):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2
      ship_id1 = c.create_oval(0,0,30, 30, outline=color1)
      ship_id2 = c.create_polygon(5,5,5,25,30, 15, fill=color2)
      MID_X = WIDTH / 2
      MID_Y = HEIGHT / 2
      c.move (ship_id1, MID_X, MID_Y)
      c.move (ship_id2, MID_X, MID_Y)
  
  def ship_move_right(event):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2, SPEED
      c.move (ship_id1, SPEED, 0)
      c.move (ship_id2, SPEED, 0)
  
  def ship_move_left(event):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2, SPEED
      c.move(ship_id1, -SPEED, 0)
      c.move(ship_id2, -SPEED, 0)
  
  def ship_move_up(event):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2, SPEED
      c.move(ship_id1,0, -SPEED)
      c.move(ship_id2,0, -SPEED)
  def ship_move_down(event):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2, SPEED
      c.move(ship_id1, 0, SPEED)
      c.move(ship_id2, 0, SPEED)
  
  def ship_move_right_fast(event):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2
      c.move (ship_id1, 20, 0)
      c.move (ship_id2, 20, 0)
  
  def ship_move_left_fast(event):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2
      c.move(ship_id1, -20, 0)
      c.move(ship_id2, -20, 0)
  
  def ship_move_up_fast(event):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2
      c.move(ship_id1,0, -20)
      c.move(ship_id2,0, -20)
  def ship_move_down_fast(event):
      global c, window, HEIGHT, WIDTH, ship_id1, ship_id2
      c.move(ship_id1, 0, 20)
      c.move(ship_id2, 0, 20)
  
  
  
  def spawn_bub():
      x = WIDTH + GAP
      y = randint(0,HEIGHT)
      rad =randint(MIN_BUB_RAD, MAX_BUB_RAD)
      id1 = c.create_oval(x-rad, y-rad, x+rad, y+rad, outline='white')
      bub_id.append(id1)
      bub_rad.append(rad)
      bub_speed.append(randint(1, MAX_BUB_SPEED))
  
  def move_bub():
      for i in range (len(bub_id)):
          c.move(bub_id[i], -bub_speed[i], 0)
  
  def move_ship():
      c.bind_all('&lt;Right&gt;', ship_move_right)
      c.bind_all('&lt;Left&gt;', ship_move_left)
      c.bind_all('&lt;Up&gt;', ship_move_up)
      c.bind_all('&lt;Down&gt;', ship_move_down)
      c.bind_all('&lt;KeyPress-d&gt;', ship_move_right)
      c.bind_all('&lt;KeyPress-a&gt;', ship_move_left)
      c.bind_all('&lt;KeyPress-w&gt;', ship_move_up)
      c.bind_all('&lt;KeyPress-s&gt;', ship_move_down)
      c.bind_all('&lt;KeyPress-D&gt;', ship_move_right_fast)
      c.bind_all('&lt;KeyPress-A&gt;', ship_move_left_fast)
      c.bind_all('&lt;KeyPress-W&gt;', ship_move_up_fast)
      c.bind_all('&lt;KeyPress-S&gt;', ship_move_down_fast)
  
  
  
  
  
  
  create_window('blue', 'Bubble Blaster', 700, 1300)
  create_ship('red', 'red')
  move_ship()
  BUB_CHANCE = 10
  while True:
      if randint(1, BUB_CHANCE) == 1:
          spawn_bub()
      move_bub()
      window.update
      sleep(0.1)
      mainloop()
  </code></pre>