def body(self, master, row, columns=DEFAULT_COLUMNS, width=4, left=False,
**kwargs):
"""
Add the labeled entry to the Frame *master* using grid at *row*.
*width* controls the width of the Entry.
*left* is ``True`` if the Entry is to the left of the Label.
*columns* is the number of columns in *master*.
Returns the number of rows taken by this element.
"""
if left:
entry_column = 0
entry_sticky = "e"
entry_width = 1
label_column = 1
label_sticky = "w"
label_width = columns - 1
else:
entry_column = 1
entry_sticky = "w"
entry_width = columns - 1
label_column = 0
label_sticky = "e"
label_width = 1
label = ttk.Label(master, text=self.text)
label.grid(row=row, column=label_column, columnspan=label_width,
sticky=label_sticky)
self.entry = ttk.Entry(master, textvariable=self.value, width=width)
self.entry.grid(row=row, column=entry_column, columnspan=entry_width,
sticky=entry_sticky)
return 1
评论列表
文章目录