1
+ import numpy as np
2
+ import pandas as pd
1
3
import tkinter as tk
2
4
from tkinter import messagebox as msg
3
5
from tkinter import ttk , Menu , Spinbox , filedialog , scrolledtext
4
6
import matplotlib as mpl
5
- import numpy as np
6
- import pandas as pd
7
+ from matplotlib import pyplot as plt
7
8
from matplotlib .backends .backend_tkagg import (
8
9
FigureCanvasTkAgg , NavigationToolbar2Tk )
9
10
from matplotlib .figure import Figure
10
- from matplotlib import pyplot as plt
11
+
11
12
12
13
# =====================================================#
13
14
# ======= Initial Parameters =======#
14
15
# =====================================================#
15
16
16
17
mpl .use ("TkAgg" )
17
18
mpl .style .use ('seaborn-bright' )
18
- root = tk .Tk ()
19
- # root .geometry("800x600")
20
- root .resizable (True , False )
21
- root .title ('GraphMaker' )
19
+ app = tk .Tk ()
20
+ # app .geometry("800x600")
21
+ app .resizable (True , False )
22
+ app .title ('GraphMaker' )
22
23
23
24
# =====================================================#
24
25
# ========= Functions Area =========#
@@ -127,13 +128,13 @@ def info_call():
127
128
128
129
# ===========| Message Box |============#
129
130
def _msgBox ():
130
- msg .showinfo ('About GraphMaker' , 'This program was made in python with Tkinter module.\n Year of development: 2020.' )
131
+ msg .showinfo ('About GraphMaker' , 'This program is made in Python with Tkinter module.\n Year of development: 2020.' )
131
132
132
133
133
134
# =========| Exit GUI cleanly |=========#
134
135
def _quit ():
135
- root .quit ()
136
- root .destroy ()
136
+ app .quit ()
137
+ app .destroy ()
137
138
exit ()
138
139
139
140
@@ -149,21 +150,13 @@ def widget_func(widget, tabName, text_, textv_, he_, wi_, command_, c_, r_, py_,
149
150
sticky = stik_ )
150
151
151
152
152
- # ==============| Widgets func |==============#
153
- '''class getWidget:
154
- def __init__(self, widget, tabName, text_, textv, height, width,
155
- command, column, row, py, px, cs, rs, stik_, **kwargs):
156
- self.textv = textv
157
- self.stik_ = stik_
158
- self.tabname = tabname
159
- '''
160
- # ======================================================================================# #### ####
161
- # ======================= Menu Area =======================# ## |##| ##
162
- # ======================================================================================# ## ## ##
153
+ # ======================================================================================#
154
+ # ======================= Menu Area =======================#
155
+ # ======================================================================================#
163
156
164
157
# -------------------| Menu Bar |-------------------#
165
- menu_bar = Menu (root )
166
- root .config (menu = menu_bar )
158
+ menu_bar = Menu (app )
159
+ app .config (menu = menu_bar )
167
160
168
161
# -------------------| File Menu |------------------#
169
162
file_menu = Menu (menu_bar , tearoff = 0 )
@@ -177,18 +170,18 @@ def __init__(self, widget, tabName, text_, textv, height, width,
177
170
help_menu .add_command (label = "About" , command = _msgBox )
178
171
menu_bar .add_cascade (label = "Help" , menu = help_menu )
179
172
180
- # ======================================================================================# ##########
181
- # ======================= Multi-Tab ======================# ##
182
- # ======================================================================================# ##
173
+ # ======================================================================================#
174
+ # ======================= Multi-Tab ======================#
175
+ # ======================================================================================#
183
176
184
- tabControl = ttk .Notebook (root )
177
+ tabControl = ttk .Notebook (app )
185
178
tab_1 = ttk .Frame (tabControl )
186
179
tabControl .add (tab_1 , text = ' Graph ' )
187
180
tabControl .pack (expand = 1 , fill = "both" )
188
181
189
- # ####################################################################################### ##
190
- # #################### Tab-1 Area ########################## ##
191
- # ####################################################################################### ##
182
+ # #######################################################################################
183
+ # #################### Tab-1 Area ##########################
184
+ # #######################################################################################
192
185
193
186
# =================| Graph-Canvas Frame |=================#
194
187
graph_frame = ttk .LabelFrame (tab_1 , text = ' Graph Canvas ' )
@@ -262,13 +255,13 @@ def __init__(self, widget, tabName, text_, textv, height, width,
262
255
curRad2 = tk .Radiobutton (grid_ , text = "Off" , variable = radVar , value = 0 , ).grid (column = 1 , row = 15 , )
263
256
264
257
# ==========================| Button Area |==========================#
265
- widget_func ('btn' , plotting , 'Add' , None , None , None , openFile , 1 , 16 , 10 , 0 , 1 , 1 , None ) # Add btn
266
- widget_func ('btn' , plotting , 'Plot' , None , None , None , plotGraph , 1 , 17 , 1 , 0 , 1 , 1 , None ) # Plot btn
267
- widget_func ('btn' , plotting , 'Refresh' , None , None , None , re_fresh , 1 , 18 , 10 , 0 , 1 , 1 , None ) # Refresh btn
268
- widget_func ('btn' , plotting , 'Close' , None , None , None , _quit , 1 , 19 , 1 , 0 , 1 , 1 , None ) # Close btn
258
+ widget_func ('btn' , plotting , 'Add' , None , None , None , openFile , 1 , 16 , 10 , 0 , 1 , 1 , None )
259
+ widget_func ('btn' , plotting , 'Plot' , None , None , None , plotGraph , 1 , 17 , 1 , 0 , 1 , 1 , None )
260
+ widget_func ('btn' , plotting , 'Refresh' , None , None , None , re_fresh , 1 , 18 , 10 , 0 , 1 , 1 , None )
261
+ widget_func ('btn' , plotting , 'Close' , None , None , None , _quit , 1 , 19 , 1 , 0 , 1 , 1 , None )
269
262
270
263
271
264
# =============| Program Icon |=============#
272
- root .iconbitmap ('gicon.ico' )
265
+ app .iconbitmap ('gicon.ico' )
273
266
274
- root .mainloop ()
267
+ app .mainloop ()
0 commit comments