title: Python tkinter Enter new Page Frame after do something success application crashed
body: <p>Trying to execute card_pay() method and when it success , enter new Page_6(Frame) ,also I set a button clicked to next page, the button Next_Page() is working ,but the method card_pay failed, it will cause the application crashed.below is my method to change page.</p>
  <pre><code>self.page_6 = Page_6(self.root)
  self.pack_forget()
  self.page_6.pack()
  </code></pre>
  <p>my code:</p>
  <pre><code>class Page_5(Frame): 
      def __init__(self, master=None):
          Frame.__init__(self, master)
          self.root = master 
          self.createPage()
      def createPage(self):
          search_card=True
          Page_Image = Image.open('D:/API_nomal/page_image/5.png')
          Page_Image_PIL=ImageTk.PhotoImage(Page_Image)
          Button_Image = Image.open('D:/API_nomal/page_image/confirm.png')
          Button_Image_PIL=ImageTk.PhotoImage(Button_Image)
          label=Label(self,image=Page_Image_PIL)
          label.image=Page_Image_PIL
          button_pay=Button(self,image = Button_Image_PIL,command=lambda: self.Next_Page(),border='0',bg='white', takefocus = 0)
          button_pay.image=Button_Image_PIL
          button_pay.place(x=877, y=895)
          label.grid(row=0, column=0)
          car_pay_thread = Thread(target=self.card_pay)
          car_pay_thread.start()
      def card_pay(self):
          global search_card
          while debug_flag==True:
              try:
                  if search_card== True:
                      self.page_6 = Page_6(self.root)
                      self.pack_forget()
                      self.page_6.pack()
              except Exception as e :
                  print traceback.format_exc()
  
      def Next_Page(self):
          self.page_6 = Page_6(self.root)
          self.pack_forget()
          self.page_6.pack()
  
  class Page_6(Frame):
      def __init__(self, master=None):
          Frame.__init__(self, master)
          self.root = master
          self.createPage()
  
      def createPage(self):
          Page_Image = Image.open('D:/API_nomal/page_image/6.png')
          Page_Image_PIL=ImageTk.PhotoImage(Page_Image)
          label=Label(self,image=Page_Image_PIL)
          label.bind(&quot;&lt;Button-1&gt;&quot;,lambda e=Page_Image_PIL:self.Next_Page())
          label.pack()
  
      def Next_Page(self):
          self.inital_page = Initial_Page(self.root)
          self.pack_forget()
  </code></pre>