0

I'm having an issue with Tkinter textbox. When you scroll appears a white line. I've wrote a simple code to let you reproduce the issue.

Note: I have this problem running the script with Python3.x, the problem doesn't show up when running it with Python2.x.

Screenshot example



import tkinter
from tkinter import *

class StdoutRedirector(object):
    def __init__(self,text_widget):
        self.text_space = text_widget

    def write(self,string):
        self.text_space.insert('end', string)
        self.text_space.see('end')


root = Tk()
root.geometry("300x300")
root.resizable(False,False)
root.title("Fattura Facile v0.2_beta")
window = Frame(root)

horiz_frame=Frame(root,height=200,width=200)
horiz_frame.pack_propagate(0)
horiz_frame.pack(side=BOTTOM)

text_box = Text(horiz_frame, wrap='word',bg="#282828",fg="white",bd=0,height=100,width=100)
text_box.pack()

sys.stdout = StdoutRedirector(text_box)

root.mainloop()


EDIT: I'm using Python 3.7.5 version , Tk 8.5 version , macOS Catalina 10.15.1 (19B88)

Alesof
  • 321
  • 2
  • 8
  • ***"appears a white line"***: Configure [Text.config-method - `highlight...=`](http://effbot.org/tkinterbook/text.htm#Tkinter.Text.config-method) – stovfl Jan 16 '20 at 13:38
  • This code doesn't have a scrollbar, so how are you scrolling? It appears that the "white line" is just the text selection. – Bryan Oakley Jan 16 '20 at 17:25
  • It isn't the selection, you can scroll with keyboard or trackpad. The first thing I tried was to set the highlighting to the same color of the background. As I said this problem doesn't show up when running with Python2.x or on Windows machine. – Alesof Jan 17 '20 at 14:05
  • @Alesof: On `MACOS` some **Style** are restricted due to *Apple's Human Interface Guideline*. Reference: [why-arent-these-tkinter-stylings-working](https://stackoverflow.com/questions/58343068/why-arent-these-tkinter-stylings-working) – stovfl Jan 17 '20 at 19:49
  • 1
    EDIT: I think it could be a problem due to an outdated version of Tk preinstalled on Mac, as on a friend's Mac the same code doesn't reproduce the problem. Thanks to all for your help, appreciate it. – Alesof Jan 18 '20 at 00:11
  • @Alesof ***"due to an outdated version of Tk"***: Please [edit] your question and add **all** version information you can get. – stovfl Jan 18 '20 at 10:11
  • @Alesof ***Tk 8.5 version***: Try to update to Tk **8.6** version – stovfl Jan 20 '20 at 09:18

0 Answers0