A text editor software project made with python. Part III
I've already made a text editor software. I used tkinter module of python for building the software. I want to share the codes of the software with the hiveans.
Tkinter is a module of python. It can be used to create GUI based applications. GUI stands for Graphical User Interface. You can use tkinter for building GUI based applications.
I am a newbie on python. After learning all the basics of python, I have started to learn tkinter. While learning tkinter, I built this software. I hope you guys will like it.
Let's jump to the code.
Text Editor
text_editor = tk.Text(main_application)
text_editor.config(wrap='word', relief=tk.FLAT)
scroll_bar = tk.Scrollbar(main_application)
scroll_bar.pack(side=tk.RIGHT, fill=tk.Y)
text_editor.focus_set()
text_editor.pack(expand=True, fill=tk.BOTH)
scroll_bar.config(command=text_editor.yview)
text_editor.config(yscrollcommand=scroll_bar.set)
font family and font size functionality
# font family and font size functionality
current_font_family = 'Arial'
current_font_size = 14
def change_font_family(main_application):
global current_font_family
current_font_family = font_family.get()
text_editor.configure(font=(current_font_family, current_font_size))
def change_font_size(main_application):
global current_font_size
current_font_size = size_var.get()
text_editor.configure(font=(current_font_family, current_font_size))
font_box.bind('<<ComboboxSelected>>', change_font_family)
font_size.bind('<<ComboboxSelected>>', change_font_size)
text_editor.configure(font=('Arial', 12))
bold button functionality
def change_bold():
text_property = tk.font.Font(font=text_editor['font'])
if text_property.actual()['weight'] == 'normal':
text_editor.configure(font=(current_font_family, current_font_size, 'bold'))
if text_property.actual()['weight'] == 'bold':
text_editor.configure(font=(current_font_family, current_font_size, 'normal'))
bold_btn.configure(command=change_bold)
to be continued...
0
0
0.000
@tipu curate 5
Upvoted 👌 (Mana: 5/55) Liquid rewards.