# To do # 1. clear file for writing # 2. create file source_file="initial source" destination_file="Initial destination" from tkinter import * def show_entry_fields(): #print("Source file: %s\nDestination file: %s" % (e1.get(), e2.get())) global source_file source_file = e1.get() global destination_file destination_file = e2.get() return def Write_Topic(Note,position,level,destination_file): fo = open(destination_file,"a") if position==0 and level==0: print (Note) fo.write('\n') fo.close() if position==2 and level==0: print (Note) fo.write('\n') fo.write('\n') fo.write('\n') fo.close() if position==2 and level==1: print (Note) fo.write('\n') fo.write('\n') fo.close() if position==1 and level==1: print ("\t",Note) fo.write('\n') fo.close() if position==1 and level==0: print (Note) fo.write('\n') fo.write('\n') fo.close() return def Write_Comment(Comment): fo = open(destination_file,"a") fo.write('\n') fo.write('\n') fo.write('\n') fo.write('\n') fo.write('

\n') fo.write(Comment) fo.write('\n') fo.write('

\n') fo.write('\n') fo.write('\n') fo.write('
\n') return def Main_Program(): fo = open(destination_file,"a") fo.write('\n') fo.write('\n') fo.close() fo = open(source_file,"r") print ("Reading....",fo) print ("\n") a=0 position=0 level=0 file_data=fo.readlines() count = len(open(source_file).readlines( )) print (count,' lines to read') while (a\n') fo.write('\n') if position==2: fo.write('
\n') fo.write('
\n') fo.write('\n') fo.write("") fo.close() return master = Tk() Label(master, text="Input txt file").grid(row=0) Label(master, text="Output Mindmap").grid(row=1) e1 = Entry(master) e2 = Entry(master) e1.grid(row=0, column=1) e2.grid(row=1, column=1) Button(master, text='Read files', command=show_entry_fields).grid(row=3, column=1, sticky=W, pady=4) Button(master, text='Write Mindmap', command=Main_Program).grid(row=4, column=1, sticky=W, pady=4) mainloop( )