Change the look of the Tkinter scrollbar widget Python Change the look of the Tkinter scrollbar widget Python tkinter tkinter

Change the look of the Tkinter scrollbar widget Python


ttk styles are the way to go.http://www.tkdocs.com/tutorial/styles.html

I use the plastik theme as a good reference, it is an image based theme.

You can then replace the images with your own.

to get the source and files:http://svn.python.org/projects/sandbox/trunk/ttk-gsoc/samples/plastik_theme.py

I just ran the 2to3 conversion tool and works great in python3

Assuming you move all the images to a relative path called /img you can do

import tkinter.ttk as ttkimport osimport plastikplastik.install((os.getcwd()+'/img/plastik'))scrollbar = ttk.Scrollbar(root)scrollbar.pack(side=RIGHT, fill=Y)listbox = Listbox(root)listbox.pack()for i in range(100):    listbox.insert(END, i)listbox.config(yscrollcommand=scrollbar.set)scrollbar.config(command=listbox.yview)

Note: You have to use the ttk.Scrollbar widget not the tkinter widget