Python 如何在tkinter中设计滚动条(不是ttk滚动条)
我曾尝试设计tkinter的滚动条,而不是使用ttk滚动条 但我无法在滚动条上实现设计。我想我已经实现了与effbot文档中相同的配置选项Python 如何在tkinter中设计滚动条(不是ttk滚动条),python,tkinter,Python,Tkinter,我曾尝试设计tkinter的滚动条,而不是使用ttk滚动条 但我无法在滚动条上实现设计。我想我已经实现了与effbot文档中相同的配置选项 from tkinter import * testing=Tk() a=Listbox(testing,height=6) sc=Scrollbar(testing,orient=VERTICAL,command=a.yview) for i in range(100): a.insert(END,i) a.config(yscrollcomman
from tkinter import *
testing=Tk()
a=Listbox(testing,height=6)
sc=Scrollbar(testing,orient=VERTICAL,command=a.yview)
for i in range(100):
a.insert(END,i)
a.config(yscrollcommand=sc.set)
def designs():
# This function does nothing :(
sc.config(background='orange',borderwidth=34)
sc.config(highlightthickness=30,highlightcolor='orange',highlightbackground='skyblue')
sc.config(troughcolor='orange')
designs() # here...
sc.pack(side=RIGHT,fill=Y)
a.pack()
testing.mainloop()
有没有办法改变滚动条槽部分和非槽部分的背景颜色以及一些效果,如活动背景?请帮忙 这个代码对我有用。我得到一个橙色的滚动条和天蓝色的突出显示边框。您使用的是什么python版本?python 3.8.3和os:windows我在windows(和OSX)中上传了一个picGUI元素,与Linux相比,它们的可定制性较差,通常无法更改背景。。。。如果你想更改滚动条的颜色,你必须使用
ttk.scrollbar
,主题为“clam”或“alt”(或切换到Linux)@j_4321,这就是原因。谢谢我曾经使用过这些样式,但它会影响其他滚动条。这就是为什么我想尝试ScrollBar()。我会发布一个答案,然后解释如何避免影响其他滚动条(它们会因为时间的变化而受到一些影响,但不会因为颜色的变化而受到影响)