By adding the following lines of code, we create a ScrolledText widget:
- Start with the GUI_radiobutton_widget.py module and save it as GUI_scrolledtext_widget.py.
- Import scrolledtext:
from tkinter import scrolledtext
- Define variables for the width and height:
scrol_w = 30scrol_h = 3
- Create a ScrolledText widget:
scr = scrolledtext.ScrolledText(win, width=scrol_w, height=scrol_h, wrap=tk.WORD)
- Position the widget:
scr.grid(column=0, columnspan=3)
The preceding steps will finally produce the following code (GUI_scrolledtext_widget.py):
- Run the code. We can actually type into our widget, and if we type enough words, ...