title: How is it possible to run functions in unnamed classes (if possible multiple?)
body: <p>I'm quite new to Python 3 and recently started programming with the tk toolkit in the form of tkinter. I started programming two classes for my Space Invaders Remix, but I came across some problems. Most commonly, I had to create multiple variables for classes for the bullets, but then I couldn't update all of them, as they were all unnamed. Here's my code, if it helps:</p>
  
  <pre><code>from tkinter import *
  import easygui
  import random
  import time
  from pygame import mixer
  
  
  
  tk = Tk()
  tk.title('Space Invaders')
  tk.resizable(600,400)
  tk.wm_attributes('-topmost', 1)
  canvas = Canvas(tk,width = 550, height=400,bd=0,highlightthickness = 0)
  canvas.pack()
  canvas.update()
  canvas.create_rectangle(0,0,600,400,fill ='black')
  position = 0
  
  class Spaceship:
      def __init__(self, canvas, colour):
  
          self.canvas = canvas
          self.id = canvas.create_rectangle(0,0,30,20, fill=colour)
          self.canvas.move(self.id, 245, 300)
          self.x = 0
          self.canvas_width = self.canvas.winfo_width()
          self.canvas.bind_all('&lt;KeyPress-Left&gt;', self.turn_left)
          self.canvas.bind_all('&lt;KeyPress-Right&gt;', self.turn_right)
  
      def update(self):
          self.canvas.move(self.id, self.x, 0)
          pos = self.canvas.coords(self.id)
          if pos[0] &lt;= 0:
              self.x = 0
          elif pos[2] &gt;= self.canvas_width:
              self.x = 0
  
      def turn_left(self, evt):
          self.x = -2
  
      def turn_right(self, evt):
          self.x = 2
  
  class Bullet:
      def __init__(self, canvas, colour):
          self.paddle = Spaceship
          self.canvas = canvas
          self.id = canvas.create_rectangle(0, 0, 10,20,fill=colour)
          self.canvas.move(self.id, position, 100)
          self.x = 0
          self.y = -1
          self.canvas_height = self.canvas.winfo_height()
  
      def update(self):
          self.canvas.move(self.id, 0, -1)
  
  
  
  
  
  spaceship = Spaceship(canvas, 'white')
  
  
  
  def add_bullet(event):
      if event.keysym == 'Up':
          Bullet(canvas,'white')
  
  
  while 1:
      canvas.bind_all('&lt;KeyPress-Up&gt;', add_bullet)
      spaceship.update()
      Bullet.update()
  
      tk.update_idletasks()
      tk.update()
      time.sleep(0.01)
  </code></pre>
  
  <p>Again, I'm quite new to Python, and there's probably a simple answer.</p>
  
  <p>By the way,I've imported</p>