I think it's a little strange to call a method on $button before you have declared $button with my $button. Maybe you patched your parser with a lookahead feature, "hey, do I declare this later, if so I can use it now, right?" :)
Now that's a trick worth knowing about! Keeping all image widgets as children of the MainWindow rather than in the widgets themselves makes managing them a lot easier (flipping images in Tk is a terrible memory leak unless done very carefully). It also allows for sharing a single photo widget among several other widgets if needed without having to reparent the original photo each time.