from Tkinter import *

class MainWindow(Frame):
    def __init__(self, *args, **kwargs):
        Frame.__init__(self, *args, **kwargs)
        self.msg = Label(self, text='Welcome to the beta Interactive Brain.\n\
Touch a region of the brain to see more about it.')
        self.msg.pack(padx=20,pady=10)
        self.button = Button(self, text="Frontal Lobe", 
                                command=self.frontal_lobe)
        self.button.pack(padx=10)
        self.button_close = Button(self, text="Close", 
                                command='exit')
        self.button_close.pack(padx=10,pady=10)

    def frontal_lobe(self):
		root = Toplevel(self)
		root.title('Frontal Lobe')

		region_name = StringVar()
		Label(root, textvariable=region_name).pack(pady=10)
		region_name.set('Frontal Lobe')

		separator = Frame(height=2, bd=1, relief=SUNKEN)
		separator.pack(fill=X, padx=5, pady=5)

		region_description = StringVar()
		Label(root, textvariable=region_description).pack(fill=BOTH, expand=1, padx=10,pady=10)
		region_description.set("This is the frontal lobe.\n\
The region that is asssociated with reasoning, planning\n\
parts of speech, movement, emotions, and problem solving")

		close_button = Button(root, text="Close", command=lambda:self.deleteChild(root))
		close_button.pack(pady=10)
		

    def deleteChild(self, w):
    	w.destroy()

# class MainWindow(Frame):
#     counter = 0
#     def __init__(self, *args, **kwargs):
#         Frame.__init__(self, *args, **kwargs)
#         self.button = Button(self, text="Create new window", 
#                                 command=self.create_window)
#         self.button.pack(side="top")

#     def create_window(self):
#         self.counter += 1
#         t = Toplevel(self)
#         t.wm_title("Window #%s" % self.counter)
#         l = Label(t, text="This is window #%s" % self.counter)
#         l.pack(side="top", fill="both", expand=True, padx=100, pady=100)

if __name__ == "__main__":
    root = Tk()
    main = MainWindow(root)
    root.title('brain beta')
    main.pack(side="top", fill="both", expand=True)
    root.mainloop()