Python, ткинтер, полоса прокрутки activebackground - PullRequest
0 голосов
/ 02 мая 2020

Как я могу изменить activebackground полос прокрутки?

class Example(tk.Frame):
    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        global frame
        style = Style()
        style.theme_use('clam')
        print(style.element_options("Horizontal.TScrollbar.thumb"))

        # configure the style
        style.configure("Horizontal.TScrollbar", gripcount=0,
                        background="Green", darkcolor="DarkGreen", lightcolor="LightGreen",
                        troughcolor="gray", bordercolor="blue", arrowcolor="red",activebackground="red",highlightcolor="green",highlightbackground="green")


        # Horizontal (x) Scroll bar
        xscrollbar = Scrollbar(frame, orient=HORIZONTAL)#style="My.Horizontal.TScrollbar")
        xscrollbar.pack(side=BOTTOM, fill="x")
        xscrollbar.place(relx=0.3,rely=0.4,relwidth=0.11,relheight=0.13)


        # Vertical (y) Scroll Bar
        yscrollbar = Scrollbar(frame)
        yscrollbar.pack(side=RIGHT, fill="y")
        yscrollbar.place(relx=0.7,rely=0.50,relwidth=0.007,relheight=0.3)


        text = ReadonlyText(frame, wrap=NONE,bg='darkblue',fg="white",selectbackground='#3a4578',
            xscrollcommand=xscrollbar.set,
            yscrollcommand=yscrollbar.set)

        text.configure(insertbackground='#d9d9d9')
        text.pack( fill="both", expand=True)
        text.place(relwidth=0.2,relheight=0.3,relx=0.5,rely=0.5)

        for i in range(0,3):
            text.insert("end", "You can edit this line\n")
            text.insert("end", "You cannot edit or delete this line", "readonly")
            text.insert("end", "You can edit this, too   .")

        text.tag_configure("readonly")


        xscrollbar.config( command = text.xview )
        yscrollbar.config( command = text.yview )

Мой стиль не может изменить activebackground, и я попробовал text.configure (activebackground = "red"), но выдает ошибку: неизвестно опция -activebackground. Что мне делать?

...