From 3c89144e3c5a6d26d120e331f59d0bfc8bffa2eb Mon Sep 17 00:00:00 2001 From: Jakob Cornell Date: Sun, 12 Jan 2020 14:16:31 -0600 Subject: [PATCH] Bug fixes --- main.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 69abf53..0aacfeb 100644 --- a/main.py +++ b/main.py @@ -312,6 +312,8 @@ class MainView(View): 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) @@ -326,17 +328,17 @@ class MainView(View): 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) -- 2.30.2