class Window def __init__ self root Tk body Frame root self parent roo

 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
class Window():
def __init__(self):
root = Tk()
body = Frame(root)
self.parent = root
body.pack(side=TOP)
self.form = PaddingForm(body)
body.focus_force()
self.cells = IntVar()
mode_body = Frame(body, bd=2, relief='groove')
mode_body.pack(side=TOP, fill=X)
mode_label = Label(mode_body, text='Cut mode:'.ljust(20)).pack(side=LEFT)
cells_rb = Radiobutton(mode_body, text='cells'.ljust(10), variable=self.cells, \
value=1, command=self.refocus)
cells_rb.pack(side=LEFT)
fields_rb = Radiobutton(mode_body, text='fields'.ljust(10), variable=self.cells, \
value=0, command=self.refocus)
fields_rb.pack(side=LEFT)
self.cells.set(0)
fields_body = Frame(body).pack()
left_label = Label(fields_body, text='Fields:'.ljust(20), anchor='nw')
left_label.pack(side=LEFT, fill=Y)
right_label = Frame(fields_body)
right_label.pack(side=LEFT, fill=Y)
self.fields = {}
for field in FIELDS:
self.fields[field] = IntVar()
self.fields[field].set(0)
checkbutton = Checkbutton(right_label, text=field.ljust(15), \
variable=self.fields[field], justify=LEFT, \
anchor='w', command=self.refocus).pack(fill=X)
body.bind('<Return>', self.read_configuration)
root.mainloop()