I would like to know, if there's a way to be able to close a tab in tkinter Notebook by clicking on an "x" next to the tab title. However I don't want to apply this to all tabs in the notebook. I want some tabs to be fixed in the window.
Here's a demonstration of what I have in mind: (please click the link, unfortunately I still can't post an image)
https://i.stack.imgur.com/SnOOY.gif
And that's the code..
from tkinter import *
from tkinter import ttk
import tkinter as tk
def open_second():
def open_2():
if pass_box.get() == "123":
tabs.add(second_tab, text='2nd X')
tabs.select(second_tab)
pass_window.destroy()
pass_window = Tk()
pass_window.geometry("200x100")
pass_window.resizable(False, False)
pass_label = Label(pass_window, text="Enter Pass:")
pass_label.place(relx=0.5, rely=0.2, anchor=CENTER)
pass_box = Entry(pass_window, show="*")
pass_box.place(relx=0.5, rely=0.5, anchor=CENTER)
pass_button = Button(pass_window, text="Enter", command=open_2)
pass_button.place(relx=0.5, rely=0.8, anchor=CENTER)
root = tk.Tk()
root.state("zoomed")
# Create tabs
tabs = ttk.Notebook(root)
tabs.pack(expand=1, fill="both")
first_tab = ttk.Frame(tabs)
tabs.add(first_tab, text='1st')
second_tab = ttk.Frame(tabs)
menubar = Menu(root)
option = Menu(menubar, tearoff=0)
option.add_command(label="2nd Tab", command=open_second)
menubar.add_cascade(label="Option", menu=option)
root.config(menu=menubar)
root.mainloop()