use Tk; needs to be: require Tk; import Tk; and MainLoop, needs to be &MainLoop;