@@ -121,7 +121,9 @@ def __init__(self, master, **kwargs):
121
121
self .export_options_row_a = tk .Frame (self .export_options_frame )
122
122
self .template_label = tk .Label (self .export_options_row_a , text = "Choose template:\t " )
123
123
self .template_label .pack (side = "left" )
124
- self .template_combobox = Combobox (self .export_options_row_a , values = constants .template_list )
124
+ self .template_combobox_value = tk .StringVar ()
125
+ self .template_combobox = Combobox (self .export_options_row_a , textvariable = self .template_combobox_value , values = constants .template_list ,)
126
+ self .template_combobox .current (0 )
125
127
self .template_combobox .pack (side = "left" )
126
128
self .export_options_export_btn = tk .Button (self .export_options_row_a , text = "Export HTML" , command = self .save_as_html_file )
127
129
self .export_options_export_btn .pack (side = "left" , padx = 0 , pady = 0 )
@@ -163,12 +165,15 @@ def __init__(self, master, **kwargs):
163
165
# Default markdown string.
164
166
default_text = constants .default_md_string
165
167
self .text_area .insert (0.0 , default_text )
168
+ self .template_top = constants .default_template_top
169
+ self .template_middle = constants .default_template_middle
170
+ self .template_bottom = constants .default_template_bottom
166
171
# Applies markdown formatting to default file.
167
172
self .check_markdown_highlighting (start = "1.0" , end = END )
168
173
self .text_area .focus_set ()
169
174
170
175
# Create right click menu layout for the editor.
171
- self .right_click = tk .Menu (self .text_area )
176
+ self .right_click = tk .Menu (self .text_area , tearoff = False )
172
177
self .right_click .add_command (label = "Copy" , command = lambda : self .focus_get ().event_generate ("<<Copy>>" ), accelerator = "Ctrl+C" )
173
178
self .right_click .add_command (label = "Cut" , command = lambda : self .focus_get ().event_generate ("<<Cut>>" ), accelerator = "Ctrl+X" )
174
179
self .right_click .add_command (label = "Paste" , command = lambda : self .focus_get ().event_generate ("<<Paste>>" ), accelerator = "Ctrl+V" )
@@ -355,10 +360,7 @@ def on_input_change(self, event):
355
360
md2html = Markdown (extensions = constants .extensions , extension_configs = constants .extension_configs )
356
361
markdownText = self .text_area .get ("1.0" , END )
357
362
html = md2html .convert (markdownText )
358
- template_top = constants .default_template_top
359
- template_middle = constants .default_template_middle
360
- template_bottom = constants .default_template_bottom
361
- final = f"{ template_top } \n { self .css } \n { template_middle } \n { html } \n { template_bottom } "
363
+ final = f"{ self .template_top } \n { self .css } \n { self .template_middle } \n { html } \n { self .template_bottom } "
362
364
self .export_options_text_area .delete ("1.0" , END )
363
365
self .export_options_text_area .insert (END , final )
364
366
self .preview_document .load_html (final )
0 commit comments