Skip to content
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ This file contains a list of all the authors of widgets in this repository. Plea
* `Config`, `ConfigSerializer`, `JSONSerializer` objects to store configuration options.
- Multiple authors:
* `ScaleEntry` (RedFantom and Juliette Monsel)
* `Notebook` (Dogeek and Juliette Monsel)
28 changes: 28 additions & 0 deletions examples/example_notebook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import tkinter as tk
import tkinter.ttk as ttk
from ttkwidgets import Notebook


class MainWindow(ttk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.nb = Notebook(root, tabdrag=True, tabmenu=True,
closebutton=True, closecommand=self.closecmd)
colors = ['red', 'blue', 'green', 'yellow', 'cyan',
'magenta', 'black', 'white', 'purple', 'brown']
self.frames = [tk.Frame(self, width=300, height=300, bg=color) for i, color in enumerate(colors)]
for i, w in enumerate(self.frames):
self.nb.add(w, text="Frame " + str(i))
w.grid()
self.nb.grid()

def closecmd(self, tab_id):
print("Close tab " + str(tab_id))
self.nb.forget(tab_id)


root = tk.Tk()
root.title("Notebook Example")
gui = MainWindow(root)
gui.grid()
root.mainloop()
16 changes: 16 additions & 0 deletions tests/test_notebook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
"""
Author : Dogeek
(C) 2019
"""

import os
from ttkwidgets import Notebook
from tests import BaseWidgetTest


class TestDirTree(BaseWidgetTest):
def test_notebook_init(self):
nb = Notebook(self.window)
nb.grid()
self.window.update()
1 change: 1 addition & 0 deletions ttkwidgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ttkwidgets.table import Table
from ttkwidgets.popupmenu import PopupMenu
from ttkwidgets.dirtreewidget import DirTree
from ttkwidgets.notebook import Notebook

from ttkwidgets.errors import TtkWidgetsError, I18NError, AssetNotFoundError, AssetMaskNotFoundError

Expand Down
Loading