/
Insert and Delete ScrolledText.py
40 lines (33 loc) · 1.1 KB
/
Insert and Delete ScrolledText.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import Tkinter as tk
import ScrolledText as tkst
from net.PyEZ_Connect import JunOS_Connection
class Log_box:
root=tk.Tk()
#########################
# Connect to JunOS #
#########################
config=str(JunOS_Connection().show()) #return self.dev_Connect.cli("show configuration")
#########################
# Create ScrolledText #
#########################
textarea=tkst.ScrolledText(root, width=50, height=20)
textarea.grid(row=0, column=0)
#########################
# EMPTY TEXT AREA #
#########################
textarea.delete(0.0, "end") #### 0.0 = row0, column0
#### Specify which row to delete
#########################
# Insert to Text Area #
#########################
textarea.insert("insert", config)
#########################
# Write to Document #
#########################
with open("Configuration.config", "w") as text_file:
text_file.write(config)
text_file.close()
###Run Inter
root.mainloop()
####Run Program
run=Log_box()