FAQ
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)]'
>>>

Search Discussions

  • Eb303 at Apr 20, 2010 at 8:24 am

    On Apr 19, 6:35?pm, KL wrote:
    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)]'
    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 -

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedApr 19, '10 at 4:35p
activeApr 20, '10 at 8:24a
posts2
users2
websitepython.org

2 users in discussion

Eb303: 1 post KL: 1 post

People

Translate

site design / logo © 2022 Grokbase