While using ScrolledText, clicking the mouse over an existing text will cause the line to appear and be pushed.
After dragging over the text with the mouse
import tkinter as tk
import tkinter.scrolledtext as tkst
count=0
win = tk.Tk()
win.geometry("640x400+100+100")
text=tk.Text(win)
#text = Text(app, state='disabled', width=44, height=5)
frame1 = tk.Frame(
master = win,
bg = '#808000'
)
frame1.pack(fill='both', expand='yes')
editArea = tkst.ScrolledText(
master = frame1,
wrap = "word",
width = 20,
height = 10
)
def countUP():
global count
editArea.configure(state='normal')
count +=1
label.config(text=str(count))
editArea.insert(tk.INSERT, "\nhello.\n")
editArea.configure(state='disabled')
# Don't use widget.place(), use pack or grid instead, since
# They behave better on scaling the window -- and you don't
# have to calculate it manually!
text.configure(state='normal')
text.insert('end', 'Some Text')
text.configure(state='disabled')
label = tk.Label(win, text="0")
label.pack()
#editArea.insert("1.0","helloworld")
#editArea.configure(state='disabled')
editArea.pack(padx=10, pady=10, fill=tk.BOTH, expand=True)
button = tk.Button(win, overrelief="solid", width=15,
command=countUP, repeatdelay=1000, repeatinterval=100)
button.pack()
# Adding some text, to see if scroll is working as we expect it
win.mainloop()
It's dirty because I can't organize it yet. But I wish I could solve this problem
I don't want the text to be properly aligned and pushed down