Tkinter-如何更改笔记本的默认边框颜色?

时间:2020-10-05 17:11:54

标签: python tkinter

在我的示例代码下面:

from tkinter import *
from tkinter import ttk

root = Tk()
root.geometry("400x300")

style=ttk.Style()
style.configure("TNotebook", highlightbackground="#848a98") # if I use another option like - background="#848a98" - the style changes, but with - highlightbackground="#848a98" - option the style doesn't change..

MainNotebook = ttk.Notebook(root, style="TNotebook")
MainNotebook.place(x=16, y=16)

Frame1=Frame(MainNotebook, background="#ffffff", width=200, height=150)
Frame1.pack()     
Frame2=Frame(MainNotebook, background="#ffffff", width=200, height=150)
Frame2.pack()

MainNotebook.add(Frame1, text="Tab1")
MainNotebook.add(Frame2, text="Tab2")

root.mainloop()

我的目标是更改“#848a98”中的默认边框颜色,但是选项highlightbackground =“#848a98”不起作用。我使用了错误的指令吗?我该如何解决我的问题?

enter image description here

0 个答案:

没有答案