小编ami*_*emi的帖子

如何更改选项卡标题框的大小和 ttk 笔记本选项卡的字体?

我想在 ttk.notebook python 3x 中更改选项卡标题的字体、宽度和高度

通过下面的代码,我可以更改选项卡标题框的宽度

text=f'{"frame 1": ^30s}
Run Code Online (Sandbox Code Playgroud)

但是如何更改“第 1 帧”的字体以及选项卡标题框的高度?

import tkinter as tk
from tkinter import ttk

root = tk.Tk()
notebook = ttk.Notebook(root)

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

notebook.add(f1, text=f'{"frame 1": ^30s}')
notebook.add(f2, text=f'{"frame 2 longer": ^30s}')

notebook.grid(row=0, column=0, sticky="nw")
root.mainloop()
Run Code Online (Sandbox Code Playgroud)

python tkinter ttk python-3.x

3
推荐指数
1
解决办法
5762
查看次数

标签 统计

python ×1

python-3.x ×1

tkinter ×1

ttk ×1