pythontkinter

Why is Tkinter scrolled text width and height different sizes?


I created a scolledtext.ScrolledText in my application and passed width=50 and height=50 but the width was half the height, so I changed width to 100 and it worked. But I was just wondering why it is like that.


Solution

  • In the ScrolledText widget, the width is the number of characters and the height is the number of lines. In your case

    height=58, width=58
    

    will give you a box that is 58 characters wide and 58 lines long. Since the fonts are approximately 7 pixels wide by 12 pixels high, it will be a rectangular box. 406x696. Increasing the width to 100 would give you a box of 700x696 which is approximately square