Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
- ##=======================================================================================================================================================================================##
- ##----------------------CODEDSKILLS.NET--------------------------------------------------------------------------------------------------------------------------------------------------##
- #-------------------TEXT EDITOR IN PYTHON-----------#
- #---------------------------------------------------#
- #
- import os #
- from tkinter import * #
- from tkinter import filedialog, colorchooser, font #
- from tkinter.messagebox import * #
- from tkinter.filedialog import * #
- from tkinter import * #
- from tkinter import messagebox #
- #---------------------------------------------------#
- #---------------------------------------------------#--------------#
- def change_color(): #
- color = colorchooser.askcolor(title="Pick a color or else...") #
- text_area.config(fg=color[1]) #
- #-----------------------------------------------------------#------#
- def change_font(*args): #
- text_area.config(font=(font_name.get(),size_box.get())) #
- #------------------------------#----------------------------#
- def new_file(): #
- window.title("Untitled") #
- text_area.delete(1.0, END) #
- #------------------------------#
- def open_file():#---------------------------------------------------------------------------------------------#
- file = askopenfilename(defaultextension=".txt", file=[("All Files","*.*"), ("Text Documents", "*.txt")]) #
- try: #----------------------------------------------------------------#
- window.title(os.path.basename(file)) #
- text_area.delete(1.0, END) #-#
- file = open(file, "r") #
- text_area.insert(1.0, file.read()) #
- except Exception: #------#
- print("couldn't read file") #
- finally: #--------------#
- file.close() #
- #--------------------#
- #--------------------#---------------------------------------------------------------------------------------#-----------------------------------------------#
- #++++++++++++++++++++++++++++++------------------------------------------------------------------------------#-----------------------------------------------#
- #------------------------------------------------------------------------------------------------------------#
- def save_file(): #-------------------------------------------------------------------------------------------#
- file = filedialog.asksaveasfilename(initialfile="untitled.txt", # DEFAULT FILE NAME WHEN SAVING FILE #
- defaultextension=".txt", # TYPE OF FILE TO SAVE #-------------#
- filetypes=[("All Files", "*.*"),# TYPE OF FILE TO SAVE #
- ("Text Documents", "*.txt")]) # TYPE OF FILE TO SAVE #
- #---------------------#------------------------------------------------------------------------#
- if file is None: #
- return #------#
- else: #+++++++++++++++++----------------#
- try: #---------------------------------#
- window.title(os.path.basename(file)) #
- file = open(file, "w") #
- file.write(text_area.get(1.0, END)) #
- except Exception: #
- print("couldn't save file") #
- #------------------------------------------------#
- #+++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------#
- #-------------------------------------------#
- def cut(): #
- text_area.event_generate("<<Cut>>") #
- def copy(): #
- text_area.event_generate("<<Copy>>") #
- def paste(): #
- text_area.event_generate("<<Paste>>") #
- def about(): #
- showinfo("Ab0u+ Th1s Pr0gr@m", "Thankyou for choosing __C0DE__ --Pad--\n This program was Coded by:\n William, James, Sova\n AKA C0D3D Jim, Coded Jim\n Please visit: https://CodedSkills.net\n Thankyou for using my shitty text editor! \n May you become one with unicorn farts...\nCopyright © CodedSkills.net + CodedSkills.org + 1337Tutorials.net") #
- def quit(): #
- window.destroy() #
- #-------------------------------#-----------#
- #+++++++++++++++++++++++++++++++#
- #-------------------------------#------------------------------------------------------------------------------------------------------------------------------#
- window = Tk() #
- window.title(" _._._._._._._._._._.--.__C0DE__.--.__Pad__.--._._._._._._._._._._._")#
- file = None #
- #-------------------------------#
- window_width = 1000 #-----------#
- window_height = 500 #-----------------------#
- screen_width = window.winfo_screenwidth() #
- screen_height = window.winfo_screenheight() #
- #-------------------------------------------#----#
- x = int((screen_width / 5) - (window_width / 5)) #
- y = int((screen_width / 5) - (window_width / 5)) #
- #------------------------------------------------#
- #+++++++++++++++++++++++++++++++------------------------------------------#
- window.geometry("{}x{}+{}+{}".format(window_width, window_height, x, y)) #
- font_name = StringVar(window) #-------------------------------------------#
- font_name.set("Arial") #
- font_size = StringVar(window) #
- font_size.set("25") #---------#
- #-------------------#
- #+++++++++++++++++++++++++++++++
- #-----------------------------------------------------------------#
- text_area = Text(window, font=(font_name.get(), font_size.get())) #
- scroll_bar = Scrollbar(text_area) #
- scroll_bar.pack(side=RIGHT, fill=Y) #
- text_area.config(yscrollcommand=scroll_bar.set) #
- window.grid_rowconfigure(0, weight=1) #
- window.grid_columnconfigure(0, weight=1) #
- text_area.grid(sticky=N + E + S + W) #
- #-----------------------------------------------------------------#
- #+++++++++++++++++++++++++++++++
- #----------------------------------------------------------------#
- frame = Frame(window) #
- frame.grid() #
- color_button = Button(frame, text="C0L0UR", command=change_color)#
- color_button.grid(row=0, column=0) #
- #----------------------------------------------------------------#
- #+++++++++++++++++++++++++++++++------------------------------------------------#
- font_box = OptionMenu(frame, font_name, *font.families(), command=change_font) #
- font_box.grid(row=0, column=1) #------------------------------------------------#
- #------------------------------#
- #+++++++++++++++++++++++++++++++
- #---------------------------------------------------------------------------------------#
- size_box = Spinbox(frame, from_=1, to=100, textvariable=font_size, command=change_font) #
- size_box.grid(row=0, column=2)#---------------------------------------------------------#
- menu_bar = Menu(window)#------#
- window.config(menu=menu_bar) #-------#
- file_menu = Menu(menu_bar, tearoff=0) #
- #-------------------------------------#
- #+++++++++++++++++++++++++++++++
- #--------------------------------------------------------#
- menu_bar.add_cascade(label="F1L3s", menu=file_menu) #
- file_menu.add_command(label="N3w", command=new_file) #
- file_menu.add_command(label="0p3N", command=open_file) #
- file_menu.add_command(label="S^V3", command=save_file) #
- file_menu.add_command(label="3x1+", command=quit) #
- #--------------------------------------------------------#
- #+++++++++++++++++++++++++++++++
- #----------------------------------------------------#
- edit_menu = Menu(menu_bar, tearoff=0) #
- menu_bar.add_cascade(label="3D1+", menu=edit_menu) #
- edit_menu.add_command(label="Cu+", command=cut) #
- edit_menu.add_command(label="C0py", command=copy) #
- edit_menu.add_command(label="PAs+e", command=paste) #
- #----------------------------------------------------#
- #+++++++++++++++++++++++++++++++
- #----------------------------------------------------#
- help_menu = Menu(menu_bar, tearoff=0) #
- menu_bar.add_cascade(label="H31P", menu=help_menu) #
- help_menu.add_command(label="Ab0u+", command=about) #
- window.mainloop() #
- #----------------------------------------------------#
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
- ##=================================================================================================================================================##
- ##-------------------------------------------------------------------------------------------------------------------------------------------------##
- ## ##
- ## ## // ##
- ##----+-#########\ ######## -+#######\\-- +########## #######\\ /#######\\ ## // ######---+-## ## /#######\\ ##
- ## ##- ##|--|## ##- ## ## ##- ## ||----- ## // ## ##----+-## ||----- +--##
- ## ## ##| |## -+## +--## ####### ## ## -- \\#######\\ ## \\ ## ## ##------\\#######\\-------+##
- ## ##- +-##|--|## ##- ## ## ##- ## ------|| ## \\ ## ## ## ------||--------##
- ## #########/ ######## -#######//- -+########## #######// \\######// ## \\ ######---+-##### ##### \\######//------+--##
- ## ##
- ## https://CodedSkills.net ##
- ##-------------------------------------------------------------------------------------------------------------------------------------------------##
- ##=================================================================================================================================================##
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
- ##=======================================================================================================================================================================================##
- ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------##
- ## ##
- ## ### #######\ #######\ ####### ######## ## ## ######## ######## ####### ######## #### ## /#######\\ ##
- ## #-## // // \ // = ## ## ## ## ##|--|## ## // ## // \\ ## ||- ##
- ## ## ##\\ ##\\ // ## ## ## ## ##| |## ###\\ ## //====\\ ## \\#######\\ ##
- ## ## // // // ## ## ## ## ##|--|## ## \\ ## // \\ ## || ##
- ## ########## ########-- ########-- // = ## #### ## ######## ## \\ ######## // \\ ####### \\######// ##
- ## ##
- ## https://1337tutorials.net ##
- ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------##
- ##=======================================================================================================================================================================================##
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement