Python text editor program ✏️

  Рет қаралды 25,271

Bro Code

Bro Code

Күн бұрын

python text editor program
#python #text #editor
Bro Code merch store 👟 :
===========================================================
teespring.com/...
===========================================================

Пікірлер: 60
@BroCodez
@BroCodez 3 жыл бұрын
# ************************************** # Python Text Editor # ************************************** import os from tkinter import * from tkinter import filedialog, colorchooser, font from tkinter.messagebox import * from tkinter.filedialog import * 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")]) if file is None: return else: 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='unititled.txt', defaultextension=".txt", filetypes=[("All Files", "*.*"), ("Text Documents", "*.txt")]) 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") finally: file.close() def cut(): text_area.event_generate("") def copy(): text_area.event_generate("") def paste(): text_area.event_generate("") def about(): showinfo("About this program", "This is a program written by YOUUUUU!!!") def quit(): window.destroy() window = Tk() window.title("Text editor program") file = None window_width = 500 window_height = 500 screen_width = window.winfo_screenwidth() screen_height = window.winfo_screenheight() x = int((screen_width / 2) - (window_width / 2)) y = int((screen_height / 2) - (window_height / 2)) 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) window.grid_rowconfigure(0, weight=1) window.grid_columnconfigure(0, weight=1) text_area.grid(sticky=N + E + S + W) scroll_bar.pack(side=RIGHT, fill=Y) text_area.config(yscrollcommand=scroll_bar.set) frame = Frame(window) frame.grid() color_button = Button(frame, text="color", 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="File", menu=file_menu) file_menu.add_command(label="New", command=new_file) file_menu.add_command(label="Open", command=open_file) file_menu.add_command(label="Save", command=save_file) file_menu.add_separator() file_menu.add_command(label="Exit", command=quit) edit_menu = Menu(menu_bar, tearoff=0) menu_bar.add_cascade(label="Edit", menu=edit_menu) edit_menu.add_command(label="Cut", command=cut) edit_menu.add_command(label="Copy", command=copy) edit_menu.add_command(label="Paste", command=paste) help_menu = Menu(menu_bar, tearoff=0) menu_bar.add_cascade(label="Help", menu=help_menu) help_menu.add_command(label="About", command=about) window.mainloop()
@fortniteenjoyer2829
@fortniteenjoyer2829 2 жыл бұрын
what a good human
@astonious
@astonious 2 жыл бұрын
correct, good human
@MyriadColorsCM
@MyriadColorsCM Жыл бұрын
I was having trouble with the save function, until I noticed I had written "Open" instead of "open". lol
@burhanmughal57
@burhanmughal57 8 ай бұрын
hey bro when i save my file they show me the error name no attribute 'close' please tell me what to do
@ogr3j3ct3d_o7
@ogr3j3ct3d_o7 2 жыл бұрын
I really wish you would give more in depth explanations of what each line of code is doing as you type it out. It would help me, and maybe many others, know exactly what it is I'm writing and what it is going to do. Considering this is a tutorial for beginners.
@abdallahbadr4335
@abdallahbadr4335 Жыл бұрын
True , he used like 500 new things and did not explain anything like the spinbox , the option menu and etc..
@madurangalakshan6629
@madurangalakshan6629 Жыл бұрын
I agree
@tatbysaeed3290
@tatbysaeed3290 9 ай бұрын
He wasn't like that at the beginning of the series, but I guess he got bored all the way down to this video. Nonetheless, he still put a lot of hard work into it."
@christianihechi
@christianihechi 3 ай бұрын
Yea. There'snt much he can do to keep the videos short. Just coy the code and paste it in ChatGPT. Ask it to explain each line of code, and what it does in a very simple, beginner friendly manner. That would help you learn more.
@Dafty23
@Dafty23 3 жыл бұрын
Instantly subbed when I saw how many videos you've posted in the past week. WOW! Thank you so much for all the tutorials! We appreciate it a ton!
@the0wolf15
@the0wolf15 Жыл бұрын
If anyone is wondering how to implement new windows not shutting down when the "core" window is closed, just copy the code you used for the "core" window, paste it into the "new_file" function and rename the window variable to something like "new_window". Make sure that the window variable in "new_file" is set to Tk() instead of Toplevel(). Also, I would love to see more tutorials on how to expand the text editor, like implementing customizable settings, features like a normal text editor (and maybe even more advanced if you want)
@minecraftguides7760
@minecraftguides7760 3 жыл бұрын
Now the Python playlist has more videos. *Cries in java*. Btw I pressed the like button even though I don't learn python, I learn java from your videos
@BroCodez
@BroCodez 3 жыл бұрын
but add the JavaFX videos tho
@minecraftguides7760
@minecraftguides7760 3 жыл бұрын
@@BroCodez I forgot about them lol
@bhavyabhagirathi3851
@bhavyabhagirathi3851 10 ай бұрын
Explained step by step, very helpful video!
@sacrajah
@sacrajah 7 ай бұрын
This is a fantastic way of teaching Python. Thank you
@googlegoogle1610
@googlegoogle1610 2 жыл бұрын
best python tutorials ever :)
@_Tomaszeq
@_Tomaszeq 2 жыл бұрын
very intresting
@lucyledezma709
@lucyledezma709 3 жыл бұрын
Hello Bro!!!. Your video is amazing!. Really thanks!!!😊
@sparkscomputerprogramming
@sparkscomputerprogramming 2 жыл бұрын
welcome
@atoprak00
@atoprak00 2 жыл бұрын
Holding scroll bar with mouse1 and scrolling is not working in this code ; By changing scroll bar as ‘ scroll_bar = Scrollbar(text_area, command=text_area.yview) ' does the job. Edit2: You can add set "Button" for setting the size of text entering from keyboard; set_button = Button(frame, text="Set", command=set_size) set_button.grid(row=0, column=3) def set_size(): try: if 0
@taijenseng
@taijenseng 3 жыл бұрын
Finally reach the project video ! Code strong bro
@arpanshah355
@arpanshah355 Жыл бұрын
i helped by doing all three easy steps! :D Thx Bro Code for making this :D
@Mo_Xtreme
@Mo_Xtreme 3 жыл бұрын
Nice video bro, have you done a games design?
@spon._.
@spon._. 2 жыл бұрын
I love how you said in About "This is a program written by YOUUUUU!!"
@jhassee
@jhassee Жыл бұрын
again, Best channel ever
@kapibara2440
@kapibara2440 8 ай бұрын
I love this tutorial! Thank you❤
@mohamedalhashmi1386
@mohamedalhashmi1386 9 ай бұрын
It was a useful program. Thank you a lot . How about if you add "do" and "Undo"
@ixkauzo5032
@ixkauzo5032 3 жыл бұрын
this man is a legend
@uuhju7004
@uuhju7004 2 жыл бұрын
Thank you so much
@shahzodsayfiddinov9510
@shahzodsayfiddinov9510 3 жыл бұрын
Thank you Bro!
@augustinejoseph4302
@augustinejoseph4302 Жыл бұрын
Thanks a lot bro🙏🙏🙏
@kiendra
@kiendra 7 ай бұрын
Can you make a text editor that's used in the terminal instead of a gui
@bastianprado1862
@bastianprado1862 3 жыл бұрын
I am using linux(ubuntu) and whenever I click the font button it selects the first one it encounters and closes the cascade menu. Do you happen to know why or how to fix it? Btw great video, loved the project. Keep it up, man!!! :D
@kyawkyawhtwe8801
@kyawkyawhtwe8801 Жыл бұрын
Thank you 😘😘
@alibahramifard3210
@alibahramifard3210 3 жыл бұрын
Perfect... But make the same program in java
@minecraftguides7760
@minecraftguides7760 3 жыл бұрын
Look in the java playlist, he done it
@rokkuzner
@rokkuzner 2 жыл бұрын
Thanks!
@d1jn
@d1jn 2 жыл бұрын
Thanks cool!
@andylanotte2174
@andylanotte2174 2 жыл бұрын
thank you bro
@joyedet1363
@joyedet1363 2 жыл бұрын
Thanks bro!
@anatoli4ok148
@anatoli4ok148 2 ай бұрын
is it me or is Bro really sound like Technoblade?
@hakimboudraa158
@hakimboudraa158 3 жыл бұрын
this is fontastic
@deepmoneyy7254
@deepmoneyy7254 3 жыл бұрын
Is it possible to change the background color? I've been trying to figure it out, but I haven't been able to.
@guljain1684
@guljain1684 Жыл бұрын
text_area.config(background='black')
@anshumanpattnaik3604
@anshumanpattnaik3604 Жыл бұрын
Yes bro I am also trying to change the background and font colour based on the value of the colour picker in hexadecimal string form but it won't change...
@Tommy-nz4ur
@Tommy-nz4ur Жыл бұрын
Copy the change_color function but replace the last line of it with 'text_area.config(bg=colour[1])' and use that as the command= for a new 'Change Background' option. works perfectly
@bourenaneayoubabdelmadid5211
@bourenaneayoubabdelmadid5211 3 жыл бұрын
Hey bro i need some help in my project if you want to help me please
@kristijanlazarev
@kristijanlazarev 6 ай бұрын
gyattttttttttttt
@vedantdeshmukh4949
@vedantdeshmukh4949 3 жыл бұрын
Hey bro
@BroCodez
@BroCodez 3 жыл бұрын
Hey!
@Amir_Plays_non_stop
@Amir_Plays_non_stop 3 жыл бұрын
I took 2 days reset, but I am back now :D
@shnn_9
@shnn_9 2 жыл бұрын
Hey you i am talking to you I just want to say i love you
@joyedet1363
@joyedet1363 2 жыл бұрын
Please like me and subscribe for more heart felting words 😆
@arpanshah355
@arpanshah355 Жыл бұрын
comment
@xPxtch
@xPxtch Жыл бұрын
i love you bro
@provokator-provocateur7603
@provokator-provocateur7603 3 жыл бұрын
I have an idea! It is popular that a group of fans has a special name. As Telusko coding channel has fans named aliens so we fans of Bro Code can be called Weirdos. 😁
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 106 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 529 М.
Новый уровень твоей сосиски
00:33
Кушать Хочу
Рет қаралды 3,9 МЛН
everything is open source if you can reverse engineer (try it RIGHT NOW!)
13:56
Low Level Learning
Рет қаралды 1,4 МЛН
Python *ARGS & **KWARGS are awesome! 📦
14:54
Bro Code
Рет қаралды 78 М.
Regular Expressions (Regex) Tutorial: How to Match Any Pattern of Text
37:55
Create a QUIZ GAME with Python 💯
9:29
Bro Code
Рет қаралды 207 М.
Intermediate Python Tutorial - Creating a Text Editor App
24:00
Tech With Tim
Рет қаралды 37 М.
Using tkinter with classes
28:23
Atlas
Рет қаралды 64 М.
Python send an email 📧
7:08
Bro Code
Рет қаралды 17 М.