]> vault307.fbx.one Git - mu_code.git/blob - tkScrolledText101.py
early learning in mu editor
[mu_code.git] / tkScrolledText101.py
1 import tkinter as tk
2 import tkinter.scrolledtext as tkst
3
4 root=tk.Tk()
5 root.title("ScrolledText")
6 frame=tk.Frame(root,bg='brown')
7 frame.pack(fill='both',expand='yes')
8
9 edit_space=tkst.ScrolledText(
10 master=frame,
11 wrap='word', # wrap text at full words only
12 width=25, # characters
13 height=10, # text lines
14 bg='beige', # background color of edit area
15 )
16 # the padx/pady space will form a frame
17 edit_space.pack(fill='both',expand=True,padx=8,pady=8)
18
19 mytext='''\
20 Man who drive like hell, bound to get there.
21
22 Man who run in front of tire, get tired.
23
24 Man who run behind car, get exhausted.
25
26 The Internet: where men are men, women are men, and children are FBI agents.
27 '''
28
29 edit_space.insert('insert',mytext)
30
31 root.mainloop()