ScrolledText滚动条颜色(Python Tkinter) [英] ScrolledText Scrollbar Color (Python Tkinter)
问题描述
我在Tkinter GUI中使用模块ScrolledText。
I'm using the module ScrolledText in a Tkinter GUI.
我想更改ScrolledText小部件中包含的滚动条的颜色,
,但我遇到了一些困难。
I wish to change the colour of the Scrollbar encompassed in the ScrolledText widget,
but I'm having some difficulty.
我的语法是正确的(根据文档)。
My syntax is correct (according to documentation).
Box = ScrolledText(root)
Box.vbar.config(troughcolor = 'red', bg = 'blue')
Box.pack()
但是,
However,
the scrollbar still has the standard grey colour.
我知道语法是正确的,因为做其他事情,例如:
I know the syntax is correct, because doing other things such as:
Box.vbar.config(cursor = 'target')
<
...works exactly as it should.
但是,尝试更改Relief,borderwidth或颜色似乎没有任何效果。
为什么会这样?
D:
However, attempting to change the Relief, borderwidth or colors don't seem to have any effect.
Why is this happening?
D:
规格:
Python 2.7.1
Tkinter
Windows 7
IDLE
Python 2.7.1
Tkinter
Windows 7
IDLE
推荐答案
Tk Scrollbar小部件(vbar)是Windows中的本机滚动条。它的外观取决于Windows主题。考虑切换工具包如果重要;我知道PyQt4将让你风格的滚动条在Windows上。
The Tk Scrollbar widget (vbar) is a native scrollbar in Windows. Its appearance depends on the Windows theme. Consider switching toolkits if it matters; I know PyQt4 will let you style the scrollbar on Windows.
这篇关于ScrolledText滚动条颜色(Python Tkinter)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!