I'm creating a multiframe tkinter application and I want user input on one frame subclass to update an image displayed on another frame subclass widget.
The only method capable of updating an image I've found is through .config(). I understand loose or tight coupling is the answer, I'm just having trouble executing.
Goal: Change Button image from another subclass
from tkinter import *
class GUI(Tk):  # Main Tk SubClass
    def __init__(self, *args, **kwargs):
        Tk.__init__(self, *args, **kwargs)
        # Photo Instances
        self.PI1= PhotoImage(file='Image1.png')
        self.PI2= PhotoImage(file='Image2.png')
        # Frame Control
        container = Frame(self)  
        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)
        container.pack(side="top",fill="both", expand=1)
        self.frames = {}
        for F in (Page_1, Page_2):
            page_name = F.__name__
            frame = F(parent=container, controller=self)
            self.frames[page_name] = frame
            frame.grid(row=0, column=0, sticky="nsew")
        self.showFrame("Page_1")
    def showFrame(self, page_name):
        frame = self.frames[page_name]
        frame.tkraise()
class Page_1(Frame): # I/P SubClass
    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.controller = controller
        def Input():
            # Page_2.tbut.config(image='pyimage2') ?????
            pass
        Button(self, text='ChangeImage', command =lambda: Input()).pack()
        #Access Page 2
        Button(self, text='Go to Page 2', command=lambda: self.controller.showFrame("Page_2")).pack()
class Page_2(Frame): # O/P SubClass                                                             
    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.controller = controller
        self.tbut=Button(self, image='pyimage1', height=45, width=45)
        self.tbut.pack()
        #Access Page 1
        Button(self, text='Go to Page 1', command=lambda: self.controller.showFrame("Page_1")).pack()
app = GUI()
app.mainloop()
Many thanks for the help!
 
    