title: Why tkinter canvas doesn't update when used in a class
body: <p>I am writing a small program, where I want to draw something on canvas. This code works for me;</p>
  
  <pre><code>import tkinter as tk
  from PIL import Image, ImageTk
  from l_systems import Lindenmayer
  
  if __name__ == "__main__":
  
      root = tk.Tk()
      root.title("Draw Shapes with L-Equations")
  
      cv = tk.Canvas(width=600, height=600, bg='white')
      cv.pack()
  
      image1 = Image.new("RGB", (600, 600), (255,255,255))
      koch = Lindenmayer(image1)
  
      koch.init(
          iterations = 6,
          angle      = 25,
          axiom      = "---X",
          rules      = {"X":"2F-[1[X]+3X]4+F[3+FX]-X", "F":"FF"},
          constants   = "X") # This creates a drawing on PIL image
  
      # Canvas.create_image expects a PhotoImage
      photo = ImageTk.PhotoImage(image1) 
      cv.create_image((300,300), image=photo)
  
  
      root.mainloop()
  </code></pre>
  
  <p>However, I want to organize my tkinter application as a class, therefore I have tried this code,</p>
  
  <pre><code>class main(tk.Frame):
  
      w = 600
      h = 600
  
      def __init__(self,parent, *args, **kwargs):
          tk.Frame.__init__(self, parent, *args, **kwargs)
  
          self.parent = parent
          self.cv = tk.Canvas(width=self.w, height=self.h, bg='white')
          self.cv.pack()
  
          self.render_image()
  
      def render_image(self):
          image1 = Image.new("RGB", (self.w, self.h), (255,255,255))
          koch = Lindenmayer(image1)
  
          koch.init(
              iterations = 6,
              angle      = 25,
              axiom      = "---X",
              rules      = {"X":"2F-[1[X]+3X]4+F[3+FX]-X", "F":"FF"},
              constants   = "X"
          )
  
          photo = ImageTk.PhotoImage(image1)
          self.cv.create_image((self.w/2,self.h/2), image=photo)
  
  if __name__ == "__main__":
  
      root = tk.Tk()
      root.title("Draw Shapes with L-Equations")
      app = main(root).pack()
      root.mainloop()
  </code></pre>
  
  <p>In this second case, I don't see any drawing on canvas. It is just a white background. How can I fix this?</p>