I currently have a ttk.Notebook, tabControl, that is initialized with a singular tab, first tab. That tab comes with a tk.Text, txt.
tabControl = ttk.Notebook(self.root)
first_tab = ttk.Frame(tabControl)
tabControl.add(first_tab, text='Tab 1')
txt = tk.Text(first_tab, wrap="word", width=30, height=10)
txt.pack(padx=5,pady=5,fill="both",expand=True)
tabControl.pack(fill="both", expand=True, side="right")
The user is offered the option of creating a new tab via a button. A user-created tab is designed as so:
def add_new_tab(notebook):
new_tab_frame = ttk.Frame(notebook)
txt = tk.Text(new_tab_frame, wrap="word", width=40, height=10)
txt.pack(padx=10,pady=10,fill="both",expand=True)
notebook.add(new_tab_frame, text="New Tab")
How would I go about accessing the tk.Text of the currently selected tab?
I ask for the reason of adding text to the text widget of the currently selected tab. User is currently only allowed to transcribe an audio file to the first_tab, but I would like a way to let the user transcribe to one tab, switch to another tab and transcribe again.
I am aware of the .select() method to find a tab, but I wasn’t able to target the tk.Text of that tab. Any help would be appreciated.