forked from PyDEF2/PyDEF-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
figure_test.py
34 lines (23 loc) · 933 Bytes
/
figure_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pydef_core.cell as pc
import pydef_core.figure as pf
import figure_windows as fw
import tkinter as tk
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
import matplotlib.pyplot as plt
root = tk.Tk()
f = plt.figure(figsize=(15, 9), dpi=100)
canvas = FigureCanvasTkAgg(f, master=root)
canvas.show()
canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
toolbar = NavigationToolbar2TkAgg(canvas, root)
toolbar.update()
canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)
figure = fw.Figure(f, 'my figure')
gga = pc.Cell('./tests/test_files/Functionals/CdIn2S4 - GGA/OUTCAR', './tests/test_files/Functionals/CdIn2S4 - GGA/DOSCAR')
pp = pc.DosPlotParameters(gga)
figure.add_subplot((1, 1, 1), gga, pp)
def open_window(event):
if event.dblclick:
fw.FigureWindow(root, figure, canvas)
canvas.mpl_connect('button_press_event', open_window)
tk.mainloop()