def on_gen_table():
from xml.etree import ElementTree
+ Elem = ElementTree.Element
+ SubElem = ElementTree.SubElement
name = self.controller.state['student']
head = list(DataEditModel.Record.DISPLAY_NAMES)
for row in rows
]
- table = Et.Element('table')
- thead = Et.SubElement(table, 'thead')
+ table = Elem('table')
+ thead = SubElem(table, 'thead')
for v in head:
- Et.SubElement(thead, 'th').text = v
- tbody = Et.SubElement(table, 'tbody')
+ SubElem(thead, 'th').text = v
+ tbody = SubElem(table, 'tbody')
for row in rows:
- tr = Et.SubElement(tbody, 'tr')
+ tr = SubElem(tbody, 'tr')
for v in row:
- Et.SubElement(tr, 'td').text = v
+ SubElem(tr, 'td').text = v
- win_write_clipboard_html(Et.dump(table))
+ win_write_clipboard_html(ElementTree.tostring(table))
self.gen_table_btn = ttk.Button(actions_frame, text = "Copy table to clipboard", command = on_gen_table)
self.student_sel.pack(**TK_PAD, side = tk.LEFT)