from tkinter import *
from tkinter import filedialog, messagebox
from pygame import *
def Quit(ev):
global root
core122 = messagebox.askyesno("Сохранение файла", "Сохранить недоделанный файл?")
if core122 == True:
SaveFile(ev)
elif core122 == False:
root.destroy()
elif core122 == None:
root.destroy()
print(core122)
def LoadFile(ev):
fn = filedialog.Open(root, filetypes=[('*.all files', '.*')]).show()
if fn == '':
return
textbox.delete('1.0', 'end')
textbox.insert('1.0', open(fn, 'rt').read())
def SaveFile(ev):
fn = filedialog.SaveAs(root, filetypes=[('*.all files', '.*')]).show()
if fn == '':
return
messagebox.showinfo('File Extension Error (021)', 'You must specify a file extension at the end!')
open(fn, 'wt').write(textbox.get('1.0', 'end'))
def clsi():
root = Tk()
root.title("FRID Redactor")
root.geometry('500x25')
lbl = Label(root, text="Fander Company. 2022 - TestProduct", font=("Helvetica", 14))
lbl.pack(fill = 'both')
def clsi1():
import webbrowser
webbrowser.open('https://www.fadcomp.tk', new=0)
root = Tk()
root.title("FRID Redactor")
menu = Menu(root)
new_item1 = Menu(menu)
new_item2 = Menu(menu)
new_item3 = Menu(menu)
new_item1.add_command(label='About', command=clsi)
new_item1.add_command(label='Site', command=clsi1)
new_item2.add_command(label='Load', command=LoadFile)
new_item2.add_command(label='Save', command=SaveFile)
new_item2.add_command(label='Quit', command=Quit)
menu.add_cascade(label='Info', menu=new_item1)
menu.add_cascade(label='File', menu=new_item2)
root.config(menu=menu)
textFrame = Frame(root, height=340, width=600)
textFrame.pack(side='bottom', fill='both', expand=1)
textbox = Text(textFrame, font='Helvetica 18', wrap='word')
scrollbar = Scrollbar(textFrame)
scrollbar['command'] = textbox.yview
textbox['yscrollcommand'] = scrollbar.set
textbox.pack(side='left', fill='both', expand=1)
scrollbar.pack(side='right', fill='y')
root.mainloop()
Выдает ошибку TypeError: Quit() missing 1 required positional argument: 'ev'