gpt4 book ai didi

python - 有没有办法将笔记本的标签设置在彼此下方?

转载 作者:行者123 更新时间:2023-11-28 16:48:23 25 4
gpt4 key购买 nike

到目前为止,当使用 ttk.Notebook 小部件时,我无法将选项卡设置在另一个下方,它们一直向东堆积。

有没有办法让它们以某种方式堆叠?

最佳答案

是的,请检查此代码:

import tkinter as tk
from tkinter import ttk

root = tk.Tk()

style = ttk.Style(root)
style.configure('lefttab.TNotebook', tabposition='wn')

notebook = ttk.Notebook(root, style='lefttab.TNotebook')

f1 = tk.Frame(notebook, bg='red', width=200, height=200)
f2 = tk.Frame(notebook, bg='blue', width=200, height=200)

notebook.add(f1, text='Frame 1')
notebook.add(f2, text='Frame 2')

notebook.grid(row=0, column=0, sticky="nw")

root.mainloop()

关于python - 有没有办法将笔记本的标签设置在彼此下方?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11387362/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com