A text editor software project made with python. Part II (Toolbar).

in #python2 years ago



source

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.

Toolbar

# ************************ Toolbar ***********************

tool_bar = tk.Label(main_application)
tool_bar.pack(side=tk.TOP, fill=tk.X)

# font box

font_tuple = tk.font.families()
font_family = tk.StringVar()
font_box = ttk.Combobox(tool_bar, width=30, state='readonly', textvariable=font_family)
font_box['values'] = font_tuple
font_box.grid(row=0, column=0, padx=5)
font_box.current(font_tuple.index('Arial'))

# size box
size_var = tk.IntVar()
font_size = ttk.Combobox(tool_bar, width=14, state='readonly', textvariable=size_var)
font_size['values'] = tuple(range(6, 81, 2))
font_size.current(3)
font_size.grid(row=0, column=1, padx=5)

# bold btn
bold_icon = tk.PhotoImage(file='TextEditorIcons/bold.png')
bold_btn = tk.Button(tool_bar, image=bold_icon)
bold_btn.grid(row=0, column=2, padx=5)

# italic btn
italic_icon = tk.PhotoImage(file='TextEditorIcons/italic.png')
italic_btn = tk.Button(tool_bar, image=italic_icon)
italic_btn.grid(row=0, column=3, padx=5)

# underline btn
underline_icon = tk.PhotoImage(file='TextEditorIcons/underline.png')
underline_btn = tk.Button(tool_bar, image=underline_icon)
underline_btn.grid(row=0, column=4, padx=5)

# font color btn
font_color_icon = tk.PhotoImage(file='TextEditorIcons/font_color.png')
font_color_btn = tk.Button(tool_bar, image=font_color_icon)
font_color_btn.grid(row=0, column=5, padx=5)

# align left btn
align_left_icon = tk.PhotoImage(file='TextEditorIcons/align_left.png')
align_left_btn = tk.Button(tool_bar, image=align_left_icon)
align_left_btn.grid(row=0, column=6, padx=5)

# align center btn
align_center_icon = tk.PhotoImage(file='TextEditorIcons/align_center.png')
align_center_btn = tk.Button(tool_bar, image=align_center_icon)
align_center_btn.grid(row=0, column=7, padx=5)

# align right btn
align_right_icon = tk.PhotoImage(file='TextEditorIcons/align_right.png')
align_right_btn = tk.Button(tool_bar, image=align_right_icon)
align_right_btn.grid(row=0, column=8, padx=5)

# ----------------------- End Tool Bar --------------------
Sort:  

Congratulations @sksksk! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You received more than 100 HP as payout for your posts, comments and curation.
Your next payout target is 250 HP.
The unit is Hive Power equivalent because post and comment rewards can be split into HP and HBD

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Level up your NFTs and continue supporting the victims of war
Support the HiveBuzz project. Vote for our proposal!