How to: ScrollArea in Python
Python supports the use of text area fields, which use a scroll bar when the user types content that exceeds the height of the field. You control the scroll bar interface in Python when you dynamically set up the text area on your Python forms. The scroll interaction sets the position of the scroll bar when the form loads on the user's desktop.
Instructions
-
-
1
Open your Python editor and open the source code file you want to edit. Copy and paste the following code to dynamically create the text area:
text = Tk()
-
2
Add text to the text area and set up the width and height for the control. The following code sets up a text area named "myarea":
text.title('myarea')
textsize = Text(text, height=200, width=100) -
-
3
Set up the scroll area. You can set a vertical or horizontal scroll bar. The following code sets up a vertical scroll bar for the user to use:
scroll = Scrollbar(text, command=text.yview)
text.configure(yscrollcommand=scroll.set)
-
1