scrobble.life
#python

A text editor software project made with python. Part I


[source](https://realpython.com/python-gui-tkinter/)
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.

Importing tkinter and others


``` import tkinter as tk from tkinter import ttk from tkinter import font, colorchooser, filedialog, messagebox import os

main_application = tk.Tk() main_application.geometry('1200x800') main_application.title('Text Editor')


### <center>

Main Menu

</center><br>

main_menu = tk.Menu()

file

file icons

new_icon = tk.PhotoImage(file='TextEditorIcons/new.png') open_icon = tk.PhotoImage(file='TextEditorIcons/open.png') save_icon = tk.PhotoImage(file='TextEditorIcons/save.png') save_as_icon = tk.PhotoImage(file='TextEditorIcons/save_as.png') exit_icon = tk.PhotoImage(file='TextEditorIcons/exit.png')

file = tk.Menu(main_menu, tearoff='False')

edit

edit icons

copy_icon = tk.PhotoImage(file='TextEditorIcons/copy.png') cut_icon = tk.PhotoImage(file='TextEditorIcons/cut.png') paste_icon = tk.PhotoImage(file='TextEditorIcons/paste.png') clear_all_icon = tk.PhotoImage(file='TextEditorIcons/clear_all.png') find_icon = tk.PhotoImage(file='TextEditorIcons/find.png')

edit = tk.Menu(main_menu, tearoff='False')

view

view icons

tool_bar_icon = tk.PhotoImage(file='TextEditorIcons/tool_bar.png') status_bar_icon = tk.PhotoImage(file='TextEditorIcons/status_bar.png')

view = tk.Menu(main_menu, tearoff='False')

color theme

color theme icons

light_default_icon = tk.PhotoImage(file='TextEditorIcons/light_default.png') light_plus_icon = tk.PhotoImage(file='TextEditorIcons/light_plus.png') dark_icon = tk.PhotoImage(file='TextEditorIcons/dark.png') red_icon = tk.PhotoImage(file='TextEditorIcons/red.png') monokai_icon = tk.PhotoImage(file='TextEditorIcons/monokai.png') night_blue_icon = tk.PhotoImage(file='TextEditorIcons/night_blue.png')

color_theme = tk.Menu(main_menu, tearoff='False')

theme_choice = tk.StringVar() color_icons = (light_default_icon, light_plus_icon, dark_icon, red_icon, monokai_icon, night_blue_icon) color_dict = { 'Light Default': ('#000000', '#ffffff'), 'Light Plus': ('#474747', '#e0e0e0'), 'Dark': ('#c4c4c4', '#2d2d2d'), 'Red': ('#2d2d2d', '#ffe8e8'), 'Monokai': ('#474747','#d3b774'), 'Night Blue': ('#ededed', '#6b9dc2') }

main_menu.add_cascade(label='File', menu=file) main_menu.add_cascade(label='Edit', menu=edit) main_menu.add_cascade(label='View', menu=view) main_menu.add_cascade(label='Color Theme', menu=color_theme)

<br>
**To be continued...**

Comments · 2