在tkinter中删除选定笔记本选项卡的功能是什么?
我在网上找不到关于此的任何信息?

这是我编写的代码,我只需要功能:

from tkinter import *
from tkinter import ttk
import math
import sys

myApp = Tk()
myApp.title(" Program ")
myApp.geometry("1000x1200")

tasktabs=ttk.Notebook(myApp)

TabOne=ttk.Frame(tasktabs)
tasktabs.add(TabOne,text="Tab One")

TabOne=ttk.Frame(tasktabs)
tasktabs.add(TabOne,text="Tab Two")

def deletetab():

    # whats the function for deleting tab?

    pass

DelButton=Button(myApp,text=' Delete  ', command=deletetab)
DelButton.grid(row=0,column=3, sticky="W")


tasktabs.grid(row=0,column=0,sticky="W")

myApp.mainloop()

最佳答案

def deletetab():
    tasktabs.forget(tasktabs.select())


删除当前选择的标签。

09-03 18:41