Skip to content

Commit 17fc8f0

Browse files
authored
Add files via upload
1 parent aa88971 commit 17fc8f0

20 files changed

+892
-0
lines changed

ManualTag/Baseframe.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Fri Jun 15 13:38:06 2018
4+
5+
@author: Rogers
6+
"""
7+
8+
from tkinter import *
9+
from tkinter.messagebox import *
10+
11+
12+
class BaseFrame(object):
13+
"""
14+
Manual text annotation tool.
15+
"""
16+
def __init__(self, root):
17+
# build basic frame
18+
self.root = root
19+
self.widget = self.root
20+
# frame 1
21+
self.frame1 = Frame(self.root, bg='SkyBlue')
22+
self.frame1.place(relx=0.01, rely=0.01, relwidth=0.33, relheight=0.96)
23+
## add display window
24+
self.t1 = Text(self.frame1, font=('TimeNews', 14), spacing1=5, wrap=NONE, undo=True)
25+
self.t1.bind('<Button-1>', self.get_widget)
26+
self.t1.place(relx=0.01, rely=0.07, relwidth=0.98, relheight=0.52)
27+
## add scroll bar
28+
s1 = Scrollbar(self.t1, orient = 'horizontal',
29+
cursor='hand2', command=self.t1.xview)
30+
s2 = Scrollbar(self.t1, orient = 'vertical',
31+
cursor='hand2', command=self.t1.yview)
32+
self.t1['xscrollcommand'] = s1.set
33+
self.t1['yscrollcommand'] = s2.set
34+
s1.pack(side='bottom', fill='x')
35+
s2.pack(side='right', fill='y')
36+
37+
# frame 2
38+
self.frame2 = Frame(self.root, bg='#FFA54F')
39+
self.frame2.place(relx=0.35, rely=0.01, relwidth=0.33, relheight=0.4)
40+
## add prompt message
41+
self.prompt1 = Text(self.frame2, bg='#FFA54F', font=('TimeNews', 14), spacing3=4.0)
42+
self.prompt1.place(relx=0, rely=0, relwidth=0.5, relheight=0.6)
43+
self.prompt2 = Text(self.frame2, bg='#FFA54F', font=('TimeNews', 14), spacing3=4.0)
44+
self.prompt2.place(relx=0.5, rely=0, relwidth=0.5, relheight=0.6)
45+
self.prompt3 = Text(self.frame2, bg='#FFA54F', font=('TimeNews', 14))
46+
self.prompt3.place(relx=0, rely=0.6, relwidth=1, relheight=0.4)
47+
48+
# frame 3
49+
self.frame3 = Frame(self.root, bg='SkyBlue')
50+
self.frame3.place(relx=0.35, rely=0.42, relwidth=0.33, relheight=0.55)
51+
## add segmented sentence display window
52+
self.t2 = Text(self.frame3, font=('宋体',14), wrap=WORD)
53+
self.t2.bind('<Button-1>', self.get_widget)
54+
self.t2.place(relx=0.01, rely=0.01, relwidth=0.98, relheight=0.3)
55+
## add input window
56+
self.t3 = Text(self.frame3, font=('宋体',14), wrap=NONE)
57+
self.t3.bind('<Button-1>', self.get_widget)
58+
self.t3.place(relx=0.01, rely=0.325, relwidth=0.98, relheight=0.66)
59+
s3 = Scrollbar(self.t3, orient = 'vertical',
60+
cursor='hand2', command=self.t3.yview)
61+
self.t3['yscrollcommand'] = s3.set
62+
s3.pack(side='right', fill='y')
63+
64+
# frame 4
65+
self.frame4 = Frame(self.root, bg='SkyBlue')
66+
self.frame4.place(relx=0.69, rely=0.01, relwidth=0.3, relheight=0.96)
67+
## add preview window
68+
self.t4 = Text(self.frame4, font=('宋体',14))
69+
self.t4.bind('<Button-1>', self.get_widget)
70+
self.t4.place(relx=0.01, rely=0.01, relwidth=0.98, relheight=0.98)
71+
## add scroll bar
72+
s4 = Scrollbar(self.t4, orient = 'vertical',
73+
cursor='hand2', command=self.t4.yview)
74+
self.t4['yscrollcommand'] = s4.set
75+
s4.pack(side='right', fill='y')
76+
77+
# frame 5
78+
self.frame5 = Frame(self.root, bg='SkyBlue')
79+
self.frame5.place(relx=0.01, rely=0.6, relwidth=0.33, relheight=0.365)
80+
## add jieba user dict display
81+
self.t5 = Text(self.frame5, font=('宋体', 14), undo=True)
82+
self.t5.bind('<Button-1>', self.get_widget)
83+
self.t5.place(relx=0.01, rely=0.12, relwidth=0.98, relheight=0.87)
84+
## add scroll bar
85+
s5 = Scrollbar(self.t5, orient = 'vertical',
86+
cursor='hand2', command=self.t5.yview)
87+
self.t5['yscrollcommand'] = s5.set
88+
s5.pack(side='right', fill=Y)
89+
90+
self.setup()
91+
92+
def setup(self):
93+
# get start position
94+
# try:
95+
# num = open('src/config.json')
96+
# nums = json.load(num)
97+
# num.close()
98+
# self.i, self.j, self.k = nums['i'], nums['j'], nums['k']
99+
# except:
100+
# self.i, self.j, self.k = 0, 0, 0
101+
pass
102+
103+
def get_widget(self, event):
104+
self.widget = event.widget
105+
106+
107+
if __name__ == '__main__':
108+
root = Tk()
109+
root.update()
110+
root.title('Data Tag')
111+
root.geometry('1920x1080')
112+
root.update()
113+
BaseFrame(root)
114+
mainloop()
3.21 KB
Binary file not shown.
126 Bytes
Binary file not shown.
873 Bytes
Binary file not shown.
8.54 KB
Binary file not shown.
1.18 KB
Binary file not shown.
1.04 KB
Binary file not shown.
1.65 KB
Binary file not shown.
262 Bytes
Binary file not shown.
12.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)