How to set the scrollbar width of a Tkinter.Text widget?

I am trying to create a Tkinter Text widget with a Scrollbar . This works fine, but I want the Scrollbar have a width of 12 pixels instead of the default value of 16 pixels. The online documentation says that width is really an option you can set. So what am I doing wrong? Below is the code I tried to use.

 from tkinter import * root = Tk() textBox = Text(root, bd=0, font=('Courier New', 8), width=100, height=25, wrap=NONE) textVerticalScroll = Scrollbar(root, width=12) textBox.configure(yscrollcommand=textVerticalScroll.set) textBox.pack(side=LEFT, fill=BOTH, expand=True) textVerticalScroll.pack(side=RIGHT, fill=Y) 
+5
source share
1 answer

Your code works, see screenshots:

width = 5:

enter image description here

width = 55:

enter image description here

I think this is due to the OS. I am using Ubuntu 14.04 x64 and python 3.4. Perhaps on windows or a poppy, the width is fixed and controlled by os. Or the tk implementation for these operating systems does not change or does not work properly.

+3
source

Source: https://habr.com/ru/post/1210076/


All Articles