You are on page 1of 2

from cgitb import text

import imp
from tkinter import *
from importlib.resources import open_text
import tkinter as tk
from tkinter.messagebox import *
from tkinter import ttk
from tkinter import filedialog as fd
from tkinter import filedialog
from tkinter .filedialog import asksaveasfile
from tkinter import END
from urllib import response

pro =Tk()
pro.geometry('800x500')
pro.title('tp compilation')
def openfile():
file=fd.askopenfilename()
if file:
fr.delete('1.0',END)
fh=open(file,'r')
read=fh.read()
fr.insert(END,read)
fh.close()

def savefile():
file =filedialog.asksaveasfile()
filetext=str(pro.get())
fille.write(filetext)
file.close

def quitter():
response= askokcancel("quitter","etes vous sur de voluoir quitter")
print(response)
if response:
pro.destroy()

menubar = Menu(pro)
f = Menu(menubar, tearoff=0)
f.add_command(label='new ' )
f.add_command(label='open',command=openfile)
f.add_command(label='save',command=lambda:savefile)

fr = tk.Text(pro,height='25',width='35')
fr.place(x=30,y=40)

fr1 = tk.Text (pro,width='35',height='25', bg='black',fg='green')


fr1.place(x=475,y=40)
fr1.config(state='disable')

f.add_separator()
menubar.add_cascade(label='file',menu=f)
pro.config(menu=menubar)
menubar.add_cascade(label='analyse',menu=pro)
pro.config(menu=menubar)
f.add_command(label='exit',command=quitter)

menubar2=Menu(pro)
p = Menu(menubar, tearoff=0)
p.add_command(label='lexical')
p.add_command(label='syntaxique')
p.add_command(label='symentique')

pro.mainloop()

You might also like