Entry
widgets seem only to deal with single line text. I need a multiline entry field to type in email messages.
Anyone has any idea how to do that?
Entry
widgets seem only to deal with single line text. I need a multiline entry field to type in email messages.
Anyone has any idea how to do that?
You could use the Text widget:
from tkinter import *
root = Tk()
text = Text(root)
text.pack()
root.mainloop()
Or with scrolling bars using ScrolledText:
from tkinter import *
from tkinter.scrolledtext import ScrolledText
root = Tk()
ScrolledText(root).pack()
root.mainloop()
Text
Widget seems to not be available in ttk. –
Sheryl from tkinter import *, from tkinter import ttk
, since * doesn't include ttk by default. –
Zink Just use Text()
widget.
For example:
import tkinter as tk
root = tk.Tk()
text = tk.Text(root)
text.pack()
root.mainloop()
Output:
Check out this post. I based it on a tutorial that I found.
It might need some extra work, depending on you requirements, but it's a good start and it is based on TreeView, but allows in-place edits.
You would just need to strip out a few CustomTkinter lines if you want to work in pure Tkinter.
© 2022 - 2024 — McMap. All rights reserved.
import Tkinter as tk; tk.Tk()...
. It makes your code more self-documenting and immune to problems caused by importing other libraries that have functions with the same name as the Tkinter widgets (for example, ttk and tk both have classes namedButton
) – Radiance