Skip to content

Commit ae213cc

Browse files
committed
pre-commit pass on fourigui
1 parent e8dfb3e commit ae213cc

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

src/diffpy/fourigui/fourigui.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1+
import time
12
import tkinter as tk
23
from tkinter.ttk import Button
34

4-
import matplotlib
5-
6-
matplotlib.use("tk.TkAgg")
7-
import time
8-
95
import h5py
6+
import matplotlib
107
import numpy as np
118
from matplotlib import pyplot as plt
12-
from matplotlib.backends.backend_tkagg import (
13-
FigureCanvastk.TkAgg,
14-
NavigationToolbar2tk.Tk,
15-
)
9+
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
10+
11+
matplotlib.use("tk.TkAgg")
1612

1713
WIDTH = 920
1814
HEIGHT = 630
@@ -46,7 +42,7 @@ def initUI(self):
4642
# frame 10: exit button
4743
# frame 11: not used
4844

49-
##### 00 #####
45+
# 00 #
5046
# frame 00, upper left
5147

5248
frame00 = tk.Frame(self)
@@ -220,7 +216,7 @@ def initUI(self):
220216
)
221217
fft.grid(row=12, column=0, columnspan=2, sticky=tk.W)
222218

223-
##### 01 #####
219+
# 01 #
224220
# frame 01, upper right
225221
self.frame01 = tk.Frame(self, bg="#cccccc")
226222
self.frame01.place(x=400, y=0) # , height=HEIGHT//2, width=WIDTH//2)
@@ -235,12 +231,14 @@ def initUI(self):
235231
label="slider",
236232
orient=tk.HORIZONTAL,
237233
length=WIDTH // 2, # resolution=-1,
238-
command=lambda l: self.multiple_funcs(
234+
command=lambda x: self.multiple_funcs(
239235
self.plot_plane(), self.intensity_upd_local()
240236
),
241237
)
242238
# command=lambda p: self.plot_plane())
243-
self.slider.grid(row=0, column=0, padx=10, pady=10, sticky=tk.N + tk.E + tk.S + tk.W)
239+
self.slider.grid(
240+
row=0, column=0, padx=10, pady=10, sticky=tk.N + tk.E + tk.S + tk.W
241+
)
244242

245243
self.frame01_plotcell = tk.Frame(self.frame01)
246244
self.frame01_plotcell.grid(
@@ -250,7 +248,7 @@ def initUI(self):
250248
self.frame01_toolbar = tk.Frame(self.frame01)
251249
self.frame01_toolbar.grid(row=2, column=0)
252250

253-
##### 10 #####
251+
# 10 #
254252
# frame 10, lower left
255253
frame10 = tk.Frame(self)
256254
frame10.place(x=5, y=HEIGHT - 30) # , height=HEIGHT//2, width=WIDTH//2)
@@ -263,7 +261,7 @@ def initUI(self):
263261
)
264262
quit.pack(side=tk.TOP)
265263

266-
##### 11 #####
264+
# 11 #
267265
# frame 00, lower right
268266
# no functionality
269267
frame11 = tk.Frame(self)
@@ -285,7 +283,7 @@ def load_cube(self):
285283
self.cube = np.array(f["data"])
286284
elif "rebinned_data" in f.keys():
287285
self.cube = np.array(f["rebinned_data"])
288-
except:
286+
except Exception:
289287
raise KeyError(
290288
"- No data found in "
291289
+ filename
@@ -304,11 +302,13 @@ def load_cube(self):
304302
label="slider",
305303
orient=tk.HORIZONTAL,
306304
length=WIDTH // 2, # resolution=-1,
307-
command=lambda l: self.multiple_funcs(
305+
command=lambda x: self.multiple_funcs(
308306
self.plot_plane(), self.intensity_upd_local()
309307
),
310308
)
311-
self.slider.grid(row=0, column=0, padx=10, pady=10, sticky=tk.N + tk.E + tk.S + tk.W)
309+
self.slider.grid(
310+
row=0, column=0, padx=10, pady=10, sticky=tk.N + tk.E + tk.S + tk.W
311+
)
312312

313313
if not self.loaded:
314314

@@ -327,12 +327,11 @@ def load_cube(self):
327327
self.im = plt.imshow(self.cube[:, :, self.plane_num.get()])
328328
else:
329329
raise ValueError("axis must be 0,1,2")
330-
axs = plt.gca()
331330
plt.colorbar(shrink=0.81)
332331
ax.set_xlabel("pixel")
333332
ax.set_ylabel("pixel")
334-
self.canvas = FigureCanvastk.TkAgg(fig, master=self.frame01_plotcell)
335-
self.toolbar = tk.NavigationToolbar2tk.Tk(self.canvas, self.frame01_toolbar)
333+
self.canvas = FigureCanvasTkAgg(fig, master=self.frame01_plotcell)
334+
self.toolbar = NavigationToolbar2Tk(self.canvas, self.frame01_toolbar)
336335
self.toolbar.pack(side=tk.LEFT)
337336
# self.toolbar.children['!button6'].pack_forget()
338337
# self.toolbar.children['!button7'].pack_forget()

0 commit comments

Comments
 (0)