我接受用户的数字 n,并且我想显示包含某些信息的 n 个选项卡,我该怎么做?
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
tabControl = ttk.Notebook(root)
tab1 = ttk.Frame(tabControl)
tab2 = ttk.Frame(tabControl)
tabControl.add(tab1, text ='Tab 1')
tabControl.add(tab2, text ='Tab 2')
tabControl.pack(expand = 1, fill ="both") # i want to make n such tabs
ttk.Label(tab1, text ="some info here").grid(column = 0, row = 0)
ttk.Label(tab2, text ="more info here").grid(column = 0, row = 0)
root.mainloop()
守着星空守着你
相关分类