#!/usr/bin/env python3
from tkinter import *

class ZButton(Button):
    def __init__(self, title, column, row, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.configure(text = title, command = self.clicked)
        self.grid(column=column, row=row)
        self.bind("<Return>", lambda e: self.clicked())

    def clicked(self):
        raise NotImplemented 

class MyButton(ZButton):
    def clicked(self):
        if(self['text'] == 'click me'): 
            self.configure(text='hahaha')
        else:
            self.configure(text='click me')

class ExitButton(ZButton):
    def __init__(self, root, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.root = root 
        self.focus_force()

    def clicked(self):
        self.root.destroy()

class MyApp:
    def __init__(self):
        root = Tk()
        root.title('Test of an app')
        self.myFrame = Frame(root)
        self.myFrame.grid(column=0, row=0, sticky=(N, W, E, S))
        self.button1 = MyButton(master=self.myFrame, title='click me', row=0, column=0)
        self.button_exit = ExitButton(root, master=self.myFrame, title='exit', row=1, column=0)
        root.mainloop()

MyApp()

@@ -37,16 +37,40 @@
 import *
+%0Afrom tkinter import ttk
 %0A%0Aclass 
@@ -290,16 +290,32 @@
  row=row
+, padx=5, pady=5
 )%0A      
@@ -609,16 +609,208 @@
 k me')%0A%0A
+class PrintButton(ZButton):%0A    def __init__(self, text, *args, **kwargs):%0A        self.text = text%0A        super().__init__(*args, **kwargs)%0A%0A    def clicked(self):%0A        print(self.text)%0A%0A
 class Ex
@@ -1134,28 +1134,132 @@
 elf.
-myF
+nb = ttk.Notebook(root)%0A        self.nb.grid(column=0, row=0, sticky=(N, W, E, S))%0A%0A        self.f
 rame
+_1
  = 
+ttk.
 Frame(
-root
+self.nb
 )%0A  
@@ -1269,23 +1269,23 @@
    self.
-myF
+f
 rame
+_1
 .grid(co
@@ -1356,39 +1356,39 @@
 ton(master=self.
-myF
+f
 rame
+_1
 , title='click m
@@ -1468,47 +1468,465 @@
 elf.
-myFrame, title='exit', row=1, column=0)
+frame_1, title='exit', row=0, column=1)%0A        self.nb.add(self.frame_1, text='Frame One')%0A%0A%0A        %0A        self.frame_2 = ttk.Frame(self.nb)%0A        self.frame_2.grid(column=0, row=0, sticky=(N, W, E, S))%0A        self.pbut1 = PrintButton(text='1', master=self.frame_2, title='print 1', row=1, column=0)%0A        self.pbut2 = PrintButton(text='2', master=self.frame_2, title='print 2', row=1, column=2)%0A        self.nb.add(self.frame_2, text='Frame Two')%0A
 %0A   

Add Notebook tabs to app