Answer the question
In order to leave comments, you need to log in
Is it possible to use ttk.notebook in ttk.notebook?
Is it possible to use ttk.Notebook in ttk.Notebook?
For example, I will provide the following code:
tab_control = ttk.Notebook(root)
tab1 = ttk.Frame(tab_control)
tab2 = ttk.Frame(tab_control)
tab_control.add(tab1, text='TEST1')
tab_control.add(tab2, text='TEST2')
rage_par = ttk.Notebook(tab2)
tab11 = ttk.Frame(rage_par)
tab22 = ttk.Frame(rage_par)
tab_control.add(tab11, text='TEST')
tab_control.add(tab22, text='TEST')
tab_control.pack(expand=1, fill='both')
tab_control.place(x=0, y=30)
rage_par.pack(expand=1, fill='both')
rage_par.place(x=0, y=80)
self.tk.call(self._w, "add", child, *(_format_optdict(kw)))
_tkinter.TclError: can't add .!notebook.!frame5.!notebook.!frame as slave of .!notebook
Answer the question
In order to leave comments, you need to log in
Firstly, you use two geometry managers at once, pack and place,
- this is not correct, leave one of the two.
Secondly, you are confused about what you are inserting into.
Here is a working one:
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
root.geometry('600x400+200+100')
tab_control = ttk.Notebook(root)
tab1 = ttk.Frame(tab_control)
tab2 = ttk.Frame(tab_control)
tab_control.add(tab1, text='TEST1')
tab_control.add(tab2, text='TEST2')
rage_par = ttk.Notebook(tab1)
tab11 = ttk.Frame(rage_par)
tab22 = ttk.Frame(rage_par)
rage_par.add(tab11, text='TEST') # вот где лажа
rage_par.add(tab22, text='TEST')
tab_control.pack(expand=1, fill='both')
# tab_control.place(x=0, y=30)
rage_par.pack(expand=1, fill='both')
root.mainloop()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question