Change the appearance of the Tkinter Python scroll widget

I was wondering if there is a way to change the appearance of the Tkinter scrollbar? I searched on the Internet, but I could not find anything by what I was looking for. I would like to change it to the look that it has, to the scroll bar that you will see in Google Chrome. Any ideas? I just need a push in the right direction.

+1
python styles tkinter scrollbar
source share
1 answer

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

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

Then you can replace the images with yours.

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

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

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

import tkinter.ttk as ttk import os import plastik plastik.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 should use the ttk.Scrollbar widget, not the tkinter widget

+2
source share

All Articles