diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..853dc39 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "C:\\Users\\server2\\Anaconda3\\python.exe" +} \ No newline at end of file diff --git a/__pycache__/CCDfiles.cpython-37.pyc b/__pycache__/CCDfiles.cpython-37.pyc new file mode 100644 index 0000000..2165a5e Binary files /dev/null and b/__pycache__/CCDfiles.cpython-37.pyc differ diff --git a/__pycache__/CCDhelp.cpython-37.pyc b/__pycache__/CCDhelp.cpython-37.pyc new file mode 100644 index 0000000..d7027d1 Binary files /dev/null and b/__pycache__/CCDhelp.cpython-37.pyc differ diff --git a/__pycache__/CCDmenusetup.cpython-37.pyc b/__pycache__/CCDmenusetup.cpython-37.pyc new file mode 100644 index 0000000..74ce6b3 Binary files /dev/null and b/__pycache__/CCDmenusetup.cpython-37.pyc differ diff --git a/__pycache__/CCDpanelsetup.cpython-37.pyc b/__pycache__/CCDpanelsetup.cpython-37.pyc new file mode 100644 index 0000000..ff3e2f7 Binary files /dev/null and b/__pycache__/CCDpanelsetup.cpython-37.pyc differ diff --git a/__pycache__/CCDplots.cpython-37.pyc b/__pycache__/CCDplots.cpython-37.pyc new file mode 100644 index 0000000..21269aa Binary files /dev/null and b/__pycache__/CCDplots.cpython-37.pyc differ diff --git a/__pycache__/CCDserial.cpython-37.pyc b/__pycache__/CCDserial.cpython-37.pyc new file mode 100644 index 0000000..8ad90e1 Binary files /dev/null and b/__pycache__/CCDserial.cpython-37.pyc differ diff --git a/__pycache__/config.cpython-37.pyc b/__pycache__/config.cpython-37.pyc new file mode 100644 index 0000000..c20a824 Binary files /dev/null and b/__pycache__/config.cpython-37.pyc differ diff --git a/matplot_in_tk.py b/matplot_in_tk.py new file mode 100644 index 0000000..56474d7 --- /dev/null +++ b/matplot_in_tk.py @@ -0,0 +1,60 @@ +## https://matplotlib.org/examples/user_interfaces/embedding_in_tk.html +import matplotlib +matplotlib.use('TkAgg') + + + +from numpy import arange, sin, pi +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk +# implement the default mpl key bindings +from matplotlib.backend_bases import key_press_handler + + +from matplotlib.figure import Figure + +import sys +if sys.version_info[0] < 3: + import Tkinter as Tk +else: + import tkinter as Tk + +root = Tk.Tk() +root.wm_title("Embedding in TK") + + +f = Figure(figsize=(5, 4), dpi=100) +a = f.add_subplot(111) +t = arange(0.0, 3.0, 0.01) +s = sin(2*pi*t) + +a.plot(t, s) + + +# a tk.DrawingArea +canvas = FigureCanvasTkAgg(f, master=root) +canvas.draw() +canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) + +toolbar = NavigationToolbar2Tk(canvas, root) +toolbar.update() +canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) + + +def on_key_event(event): + print('you pressed %s' % event.key) + key_press_handler(event, canvas, toolbar) + +canvas.mpl_connect('key_press_event', on_key_event) + + +def _quit(): + root.quit() # stops mainloop + root.destroy() # this is necessary on Windows to prevent + # Fatal Python Error: PyEval_RestoreThread: NULL tstate + +button = Tk.Button(master=root, text='Quit', command=_quit) +button.pack(side=Tk.BOTTOM) + +Tk.mainloop() +# If you put root.destroy() here, it will cause an error if +# the window is closed with the window manager. \ No newline at end of file