Prev: Python 2.6 SSL module: Fails on key file error, with Errno336265225, without a key file.
Next: default value in list comprehension
From: eb303 on 20 Apr 2010 04:24 On Apr 19, 6:35 pm, KL <klu1...(a)gmail.com> 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 - |