4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

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

![image.png](https://images.hive.blog/DQme4Y8Aj6w5tRMZu65TXUecCGnonatnRW6TwSnFhvVk1p4/image.png)
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

![image.png](https://images.hive.blog/DQmVVnFPP9XvRk6gvTeNJhsYoTuGWw8iQeKa5SFFiiYLi5G/image.png)
# 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

![image.png](https://images.hive.blog/DQmNocuNct9nqqMTqDvYyyQ48nQfiSsbfnExbM8n3RsY2Zf/image.png)
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...**
37 upvotes 1 downvotes $5.88

Replies (2)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: