Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python3.4 tkinter.scrolledtext not callable

I write this simple code:

from tkinter import *
from tkinter import ttk
import tkinter.scrolledtext

root = Tk()
textPad = tkinter.scrolledtext(root)
textPad.pack()
root.mainloop()

But not run. output is:

Traceback (most recent call last):
  File "E:/m/lale/test/test.py", line 6, in <module>
    textPad = tkinter.scrolledtext(root)
TypeError: 'module' object is not callable
like image 473
mlibre Avatar asked Dec 12 '22 03:12

mlibre


1 Answers

You are almost there. You need the ScrolledText class from the scrolledtext module. This works.

import tkinter as tk
from tkinter.scrolledtext import ScrolledText

root = tk.Tk()
textPad = ScrolledText(root)
textPad.pack()
root.mainloop()
like image 186
Terry Jan Reedy Avatar answered Jan 01 '23 08:01

Terry Jan Reedy