'How to add multiple Notebook tabs (tkinter) without crossing main window border?
Got non-resizable window, Notebook object and 3 tabs. Notebook object go out of window frame with third tab title (I don't want that).
Tab titles should become smaller with each new tab added (if total tabs titles width is more then main window width).
Thanks.
from tkinter import Frame, Tk, ttk
root = Tk()
root.geometry(newGeometry='200x200')
root.resizable(False, False)
notebook = ttk.Notebook(root, width=100, height=100)
f1 = Frame(notebook, bg='red')
f2 = Frame(notebook, bg='blue')
f3 = Frame(notebook, bg='yellow')
notebook.add(f1, text="frame 1")
notebook.add(f2, text="frame 2")
notebook.add(f3, text="frame 3")
notebook.grid(row=0, column=0, sticky="nw")
root.mainloop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|