Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tkinter scrollbar background color doesn't work

6 views
Skip to first unread message

KL

unread,
Apr 19, 2010, 12:35:50 PM4/19/10
to
Tkinter scrollbar widget's "background" and "relief" options seem not
work.

The below is the codes I tried and the python/tk information:
===================

ActivePython 2.6.4.8 (ActiveState Software Inc.) based on
Python 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit
(Intel)] on
win32
>>> from Tkinter import *
>>> r=Tk()
>>> s=Scrollbar(r,bg="#000")
>>> s.grid()
>>> s['activebackground'] = "#000"
>>> s['relief'] = "sunken"
>>>
>>> TkVersion
8.5
>>> import sys
>>> sys.version
'2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit
(Intel)]'
>>>

eb303

unread,
Apr 20, 2010, 4:24:41 AM4/20/10
to

On Windows, tk scrollbars are actually native scrollbars. So if native
scrollbars don't allow changing their background or active background
color, tk won't allow it either. Your script works as expected on
Linux, but neither on Windows, nor on a Macintosh (where native
scrollbars are used too). This is just how tk/Tkinter works, so I
don't think there's any solution for it, except creating your own
scrollbar widget by yourself.

HTH
- Eric -

0 new messages