Advertisement
c0d3dsk1lls

C0D3 PaD CodedSkills.net

Aug 5th, 2022 (edited)
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 14.20 KB | None | 0 0
  1.  
  2. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
  3. ##=======================================================================================================================================================================================##
  4. ##----------------------CODEDSKILLS.NET--------------------------------------------------------------------------------------------------------------------------------------------------##
  5. #-------------------TEXT EDITOR IN PYTHON-----------#
  6. #---------------------------------------------------#
  7.                                                     #
  8. import os                                           #
  9. from tkinter import *                               #
  10. from tkinter import filedialog, colorchooser, font  #
  11. from tkinter.messagebox import *                    #
  12. from tkinter.filedialog import *                    #
  13. from tkinter import *                               #
  14. from tkinter import messagebox                      #
  15. #---------------------------------------------------#                          
  16. #---------------------------------------------------#--------------#
  17. def change_color():                                                #
  18.     color = colorchooser.askcolor(title="Pick a color or else...") #
  19.     text_area.config(fg=color[1])                                  #
  20. #-----------------------------------------------------------#------#
  21. def change_font(*args):                                     #
  22.     text_area.config(font=(font_name.get(),size_box.get())) #
  23. #------------------------------#----------------------------#  
  24. def new_file():                #
  25.     window.title("Untitled")   #
  26.     text_area.delete(1.0, END) #
  27. #------------------------------#
  28. def open_file():#---------------------------------------------------------------------------------------------#
  29.     file = askopenfilename(defaultextension=".txt", file=[("All Files","*.*"), ("Text Documents", "*.txt")])  #
  30.     try:                                     #----------------------------------------------------------------#
  31.         window.title(os.path.basename(file)) #
  32.         text_area.delete(1.0, END)         #-#
  33.         file = open(file, "r")             #
  34.         text_area.insert(1.0, file.read()) #
  35.     except Exception:               #------#
  36.         print("couldn't read file") #
  37.     finally:         #--------------#
  38.         file.close() #
  39. #--------------------#
  40. #--------------------#---------------------------------------------------------------------------------------#-----------------------------------------------#
  41. #++++++++++++++++++++++++++++++------------------------------------------------------------------------------#-----------------------------------------------#
  42. #------------------------------------------------------------------------------------------------------------#
  43. def save_file(): #-------------------------------------------------------------------------------------------#
  44.     file = filedialog.asksaveasfilename(initialfile="untitled.txt",     # DEFAULT FILE NAME WHEN SAVING FILE #
  45.                                         defaultextension=".txt",        # TYPE OF FILE TO SAVE #-------------#
  46.                                         filetypes=[("All Files", "*.*"),# TYPE OF FILE TO SAVE #
  47.                                        ("Text Documents", "*.txt")])    # TYPE OF FILE TO SAVE #
  48. #---------------------#------------------------------------------------------------------------#
  49.     if file is None:  #                          
  50.         return #------#                                
  51.     else:      #+++++++++++++++++----------------#                                        
  52.         try:   #---------------------------------#                                    
  53.             window.title(os.path.basename(file)) #
  54.             file = open(file, "w")               #
  55.             file.write(text_area.get(1.0, END))  #
  56.         except Exception:                        #
  57.             print("couldn't save file")          #
  58. #------------------------------------------------#  
  59. #+++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------#
  60. #-------------------------------------------#
  61. def cut():                                  #
  62.     text_area.event_generate("<<Cut>>")     #
  63. def copy():                                 #
  64.     text_area.event_generate("<<Copy>>")    #
  65. def paste():                                #
  66.     text_area.event_generate("<<Paste>>")   #
  67. def about():                                #
  68.     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")          #
  69. def quit():                                 #
  70.     window.destroy()                        #
  71. #-------------------------------#-----------#
  72. #+++++++++++++++++++++++++++++++#
  73. #-------------------------------#------------------------------------------------------------------------------------------------------------------------------#
  74. window = Tk()                   #
  75. window.title(" _._._._._._._._._._.--.__C0DE__.--.__Pad__.--._._._._._._._._._._._")#
  76. file = None                     #
  77. #-------------------------------#
  78. window_width = 1000 #-----------#
  79. window_height = 500 #-----------------------#
  80. screen_width = window.winfo_screenwidth()   #
  81. screen_height = window.winfo_screenheight() #
  82. #-------------------------------------------#----#
  83. x = int((screen_width / 5) - (window_width / 5)) #
  84. y = int((screen_width / 5) - (window_width / 5)) #
  85. #------------------------------------------------#
  86. #+++++++++++++++++++++++++++++++------------------------------------------#
  87. window.geometry("{}x{}+{}+{}".format(window_width, window_height, x, y))  #
  88. font_name = StringVar(window) #-------------------------------------------#
  89. font_name.set("Arial")        #
  90. font_size = StringVar(window) #
  91. font_size.set("25") #---------#
  92. #-------------------#
  93.  
  94. #+++++++++++++++++++++++++++++++
  95. #-----------------------------------------------------------------#
  96. text_area = Text(window, font=(font_name.get(), font_size.get())) #
  97. scroll_bar = Scrollbar(text_area)                                 #
  98. scroll_bar.pack(side=RIGHT, fill=Y)                               #
  99. text_area.config(yscrollcommand=scroll_bar.set)                   #
  100. window.grid_rowconfigure(0, weight=1)                             #
  101. window.grid_columnconfigure(0, weight=1)                          #
  102. text_area.grid(sticky=N + E + S + W)                              #
  103. #-----------------------------------------------------------------#
  104. #+++++++++++++++++++++++++++++++
  105. #----------------------------------------------------------------#
  106. frame = Frame(window)                                            #
  107. frame.grid()                                                     #
  108. color_button = Button(frame, text="C0L0UR", command=change_color)#
  109. color_button.grid(row=0, column=0)                               #                  
  110. #----------------------------------------------------------------#
  111. #+++++++++++++++++++++++++++++++------------------------------------------------#
  112. font_box = OptionMenu(frame, font_name, *font.families(), command=change_font)  #
  113. font_box.grid(row=0, column=1) #------------------------------------------------#
  114. #------------------------------#
  115. #+++++++++++++++++++++++++++++++
  116. #---------------------------------------------------------------------------------------#
  117. size_box = Spinbox(frame, from_=1, to=100, textvariable=font_size, command=change_font) #
  118. size_box.grid(row=0, column=2)#---------------------------------------------------------#                                                          
  119. menu_bar = Menu(window)#------#  
  120. window.config(menu=menu_bar)  #-------#
  121. file_menu = Menu(menu_bar, tearoff=0) #
  122. #-------------------------------------#
  123. #+++++++++++++++++++++++++++++++
  124. #--------------------------------------------------------#
  125. menu_bar.add_cascade(label="F1L3s", menu=file_menu)      #
  126. file_menu.add_command(label="N3w", command=new_file)     #
  127. file_menu.add_command(label="0p3N", command=open_file)   #
  128. file_menu.add_command(label="S^V3", command=save_file)   #
  129. file_menu.add_command(label="3x1+", command=quit)        #
  130. #--------------------------------------------------------#
  131. #+++++++++++++++++++++++++++++++
  132. #----------------------------------------------------#
  133. edit_menu = Menu(menu_bar, tearoff=0)                #
  134. menu_bar.add_cascade(label="3D1+", menu=edit_menu)   #
  135. edit_menu.add_command(label="Cu+", command=cut)      #
  136. edit_menu.add_command(label="C0py", command=copy)    #
  137. edit_menu.add_command(label="PAs+e", command=paste)  #
  138. #----------------------------------------------------#
  139. #+++++++++++++++++++++++++++++++
  140. #----------------------------------------------------#
  141. help_menu = Menu(menu_bar, tearoff=0)                #
  142. menu_bar.add_cascade(label="H31P", menu=help_menu)   #
  143. help_menu.add_command(label="Ab0u+", command=about)  #                            
  144. window.mainloop()                                    #
  145. #----------------------------------------------------#
  146. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
  147. ##=================================================================================================================================================##
  148. ##-------------------------------------------------------------------------------------------------------------------------------------------------##
  149. ##                                                                                                                                                 ##
  150. ##                                                                                        ##   //                                                  ##
  151. ##----+-#########\   ########  -+#######\\-- +##########   #######\\        /#######\\    ##  //     ######---+-##      ##       /#######\\        ##
  152. ##      ##-          ##|--|##    ##-     ##   ##           ##-     ##      ||-----        ## //        ##       ##----+-##      ||-----         +--##
  153. ##      ##           ##|  |##  -+##    +--##  #######      ##       ##  -- \\#######\\    ## \\        ##       ##      ##------\\#######\\-------+##
  154. ##      ##-        +-##|--|##    ##-     ##   ##           ##-     ##         ------||    ##  \\       ##       ##      ##         ------||--------##
  155. ##      #########/   ########  -#######//-  -+##########   #######//       \\######//     ##   \\    ######---+-#####   #####   \\######//------+--##
  156. ##                                                                                                                                                 ##
  157. ##                                                          https://CodedSkills.net                                                                ##
  158. ##-------------------------------------------------------------------------------------------------------------------------------------------------##
  159. ##=================================================================================================================================================##
  160. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
  161.  
  162.  
  163. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
  164. ##=======================================================================================================================================================================================##
  165. ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------##
  166. ##                                                                                                                                                                                       ##
  167. ##           ###       #######\    #######\       #######       ########     ##  ##     ########     ########       #######     ########       ####        ##         /#######\\         ##
  168. ##          #-##            //          //        \   //    =      ##        ##  ##        ##        ##|--|##       ##  //         ##         //  \\       ##        ||-                 ##
  169. ##            ##          ##\\        ##\\           //            ##        ##  ##        ##        ##|  |##       ###\\          ##        //====\\      ##        \\#######\\         ##
  170. ##            ##            //          //          //             ##        ##  ##        ##        ##|--|##       ##  \\         ##       //      \\     ##                 ||         ##
  171. ##       ##########   ########--  ########--       //       =      ##         ####         ##        ########       ##   \\     ########   //        \\    #######   \\######//          ##
  172. ##                                                                                                                                                                                       ##
  173. ##                                                                         https://1337tutorials.net                                                                                     ##
  174. ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------##
  175. ##=======================================================================================================================================================================================##
  176. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement