Blame view

gui/tp_audine_elec/tp_audine_elec.py 16.7 KB
72560278   Alain Klotz   Update of Ima cla...
1
2
3
4
5
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 11 15:39:17 2021

@author: alain
a312560d   aklotz   TP CCD
6

d5e4f9ca   Alain Klotz   platform for TP CCD
7
$ cd ~/guitastro/gui/tp_audine_elec
a312560d   aklotz   TP CCD
8
$ python3 tp_audine_elec.py
72560278   Alain Klotz   Update of Ima cla...
9
10
11
12
13
"""

import os
import sys
import yaml
ecf46cbe   Alain Klotz   TP Audine
14
15
import subprocess
import time
94c41643   Alain Klotz   Add schemes to TP...
16
from PIL import ImageTk, Image
72560278   Alain Klotz   Update of Ima cla...
17
import tkinter as tk
a88e292a   aklotz   Add Combobox for ...
18
from tkinter import ttk
94c41643   Alain Klotz   Add schemes to TP...
19
20
21
import tkinter.font as tkFont
import tkinter.scrolledtext as tkscrolled

d5e4f9ca   Alain Klotz   platform for TP CCD
22
import platform
72560278   Alain Klotz   Update of Ima cla...
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

path = os.path.abspath("../../src")
if path not in sys.path:
        sys.path.insert(0,path)
import guitastro

# #####################################################################
# #####################################################################
# #####################################################################
# Main
# #####################################################################
# #####################################################################
# #####################################################################

if __name__ == "__main__":

    # --- Get path_images for examples
94c41643   Alain Klotz   Add schemes to TP...
40
41
42
43
    ima1 = guitastro.Ima()
    path_products = ima1.copy_data2products()

    # --- Global variable config for the YML file
72560278   Alain Klotz   Update of Ima cla...
44
45
46
47
    fconfig = os.path.join(path_products,"tp_audine_elec.yml")
    if not os.path.exists(fconfig):
        config = {}
        conf = {}
63a793df   aklotz   TP CCD
48
        conf["fits_path"] = "/home/user/Documents"
72560278   Alain Klotz   Update of Ima cla...
49
50
51
52
53
54
55
        config["visu1"] = conf
    else:
        with open(fconfig, 'r') as stream:
            try:
                config = yaml.safe_load(stream)
            except yaml.YAMLError as exc:
                print(exc)
d5e4f9ca   Alain Klotz   platform for TP CCD
56

94c41643   Alain Klotz   Add schemes to TP...
57
    # --- Global variable to select the method
b355c4be   aklotz   Fix bugs C code
58
    methods = ["full_frame", "zi_zh", "fast_line", "read_pel_fast", "read_pel_fast2", "fast_vidage"] #, "square_signal", "set_0", "set_255"]
811f0a5f   aklotz   Add methods for T...
59

94c41643   Alain Klotz   Add schemes to TP...
60
    # --- Global variable to define info messages
a312560d   aklotz   TP CCD
61
    infos = {}
811f0a5f   aklotz   Add methods for T...
62
    infos['demarrer_acq'] = "Appuyez sur le bouton Acquisition pour envoyer des signaux à la caméra"
a312560d   aklotz   TP CCD
63
    infos['acq_en_cours'] = "Acquisition en cours. Attendre quelques secondes... Prendre des mesures à l'oscilloscope"
e10c7309   Alain Klotz   Compatibility mul...
64
    infos['acq_impossible'] = "Acquisition impossible sur cet OS. Utiliser un Raspberry PI"
811f0a5f   aklotz   Add methods for T...
65
    infos['bad_method'] = f"Method not found amonsgt {methods}"
94c41643   Alain Klotz   Add schemes to TP...
66
67

    # --- Global variable for Tk variables
a312560d   aklotz   TP CCD
68
    var = {}
94c41643   Alain Klotz   Add schemes to TP...
69
70
    var['executable'] = "/home/user/iut/tp_ccd/bin/Debug/tp_ccd"
    var['c_code_filename'] = os.path.join(os.getcwd(), "main.cpp")
7c492583   Alain Klotz   Update TP CCD.
71
    var['c_code_filename_alt'] = "main.cpp"
94c41643   Alain Klotz   Add schemes to TP...
72
73
74
    var['image_path'] = "/home/user/Documents"
    var['image_filename'] = "image.fit"

94c41643   Alain Klotz   Add schemes to TP...
75
76
77
78
79
    # ===================================================
    # ===================================================
    # Function definitions
    # ===================================================
    # ===================================================
72560278   Alain Klotz   Update of Ima cla...
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

    def save_config():
        global fconfig
        with open(fconfig, 'w') as yaml_file:
            yaml.dump(config, yaml_file, default_flow_style=False)

    def ima1_load():
        global widgets
        path_cur = config["visu1"]["fits_path"]
        ima1.rootdir = path_cur
        fullfile = ima1.load()
        if fullfile != "":
            path_new = os.path.dirname(fullfile)
            if path_cur != path_new and path_new != "":
                config["visu1"]["fits_path"] = path_new
                save_config()
        visu1.autocuts()
        visu1.disp()
        widgets["button_saveima_1"].configure(state= tk.NORMAL)

    def ima1_save():
        ima1.save()

ecf46cbe   Alain Klotz   TP Audine
103
    def acquisition():
63a793df   aklotz   TP CCD
104
        global widgets
a312560d   aklotz   TP CCD
105
106
        global infos
        global var
811f0a5f   aklotz   Add methods for T...
107
        global methods
a312560d   aklotz   TP CCD
108
109
110
111
        widgets["button_loadima_1"].configure(state= tk.DISABLED)
        widgets["button_saveima_1"].configure(state= tk.DISABLED)
        widgets["button_acq"].configure(state= tk.DISABLED)
        var['info'].set(infos['acq_en_cours'])
d5e4f9ca   Alain Klotz   platform for TP CCD
112
        # ---
a88e292a   aklotz   Add Combobox for ...
113
        method = var_method.get()
811f0a5f   aklotz   Add methods for T...
114
115
116
117
118
119
120
121
122
        if method in methods:
            meth = method
        else:
            var['info'].set(infos['bad_method'])
            tkroot.update()
            time.sleep(5)
            var['info'].set(infos['demarrer_acq'])
            tkroot.update()
            return
a88e292a   aklotz   Add Combobox for ...
123
        # ---
ecf46cbe   Alain Klotz   TP Audine
124
        expo = var_exp.get()
a312560d   aklotz   TP CCD
125
126
127
128
129
        if expo < 0:
            expo = 0
        if expo > 30:
            expo = 30
        var_exp.set(expo)
d5e4f9ca   Alain Klotz   platform for TP CCD
130
        # ---
ecf46cbe   Alain Klotz   TP Audine
131
        binn = var_bin.get()
a312560d   aklotz   TP CCD
132
133
134
135
136
137
138
        if binn < 1:
            binn = 1
        if binn > 100:
            binn = 100
        var_bin.set(binn)
        # ---
        tkroot.update()
ecf46cbe   Alain Klotz   TP Audine
139
140
        # ---
        argus = []
94c41643   Alain Klotz   Add schemes to TP...
141
        argus.append(var['executable'])
a88e292a   aklotz   Add Combobox for ...
142
        argus.append(f"{meth}")
ecf46cbe   Alain Klotz   TP Audine
143
144
145
        argus.append(f"{expo}")
        argus.append(f"{binn}")
        # --- Launch the acquisition process
872a2de4   aklotz   Add platform for ...
146
        t0 = time.time()
ecf46cbe   Alain Klotz   TP Audine
147
148
        message = f'subprocess.run({argus},capture_output=True)'
        print(message)
e10c7309   Alain Klotz   Compatibility mul...
149
        release = platform.release()
872a2de4   aklotz   Add platform for ...
150
        image = False
e10c7309   Alain Klotz   Compatibility mul...
151
        if "raspi" in release:
872a2de4   aklotz   Add platform for ...
152
153
154
            # Launch the process only for Raspberry
            res = subprocess.run(argus, capture_output=True)
            stdo = res.stdout
e10c7309   Alain Klotz   Compatibility mul...
155
            print(stdo)
872a2de4   aklotz   Add platform for ...
156
            #lstdos = str(stdo).split("\\n")
811f0a5f   aklotz   Add methods for T...
157
158
159
160
            if meth == "full_frame":
                image = True
            else:
                time.sleep(1)
872a2de4   aklotz   Add platform for ...
161
        else:
e10c7309   Alain Klotz   Compatibility mul...
162
163
164
            var['info'].set(infos['acq_impossible'])
            tkroot.update()
            time.sleep(5)
ecf46cbe   Alain Klotz   TP Audine
165
166
        dt = time.time() - t0
        message = f"Acquisition done in {dt:.3f} sec"
e10c7309   Alain Klotz   Compatibility mul...
167
        print(message)        # ---
872a2de4   aklotz   Add platform for ...
168
        if meth=="full_frame" and image==True:
a88e292a   aklotz   Add Combobox for ...
169
            time.sleep(0.5)
94c41643   Alain Klotz   Add schemes to TP...
170
171
            fname = os.path.join(var['image_path'],var['image_filename'])
            fullfile = ima1.load(fname)
a88e292a   aklotz   Add Combobox for ...
172
173
174
175
176
177
178
179
            path_new = os.path.dirname(fullfile)
            config["visu1"]["fits_path"] = path_new
            ima1.rootdir = path_new
            save_config()
	        # ---
            visu1.autocuts()
            visu1.disp()
        # ---
a312560d   aklotz   TP CCD
180
        widgets["button_loadima_1"].configure(state= tk.NORMAL)
63a793df   aklotz   TP CCD
181
        widgets["button_saveima_1"].configure(state= tk.NORMAL)
a312560d   aklotz   TP CCD
182
183
        widgets["button_acq"].configure(state= tk.NORMAL)
        var['info'].set(infos['demarrer_acq'])
94c41643   Alain Klotz   Add schemes to TP...
184
        # --- update the plot
ecf46cbe   Alain Klotz   TP Audine
185
186
        tkroot.update()

94c41643   Alain Klotz   Add schemes to TP...
187
188
189
190
191
    # ===================================================
    # ===================================================
    # Start main code
    # ===================================================
    # ===================================================
72560278   Alain Klotz   Update of Ima cla...
192

94c41643   Alain Klotz   Add schemes to TP...
193
    # --- Create a Tk interface
72560278   Alain Klotz   Update of Ima cla...
194
    tkroot = tk.Tk()
f2387923   aklotz   Add schemes for T...
195
    dimx = 1600
a88e292a   aklotz   Add Combobox for ...
196
    dimy = 880
94c41643   Alain Klotz   Add schemes to TP...
197
    geom = f"{dimx}x{dimy}+80+0"
a312560d   aklotz   TP CCD
198
    tkroot.geometry(geom)
d378d70a   aklotz   TP CCD
199
    tkroot.title("TP CCD Electronique - BUT S5")
a312560d   aklotz   TP CCD
200
    tkroot.minsize(height=dimy, width=dimx)
a88e292a   aklotz   Add Combobox for ...
201
    tkroot.maxsize(height=dimy+50, width=dimx+50)
d5e4f9ca   Alain Klotz   platform for TP CCD
202

94c41643   Alain Klotz   Add schemes to TP...
203
204
205
206
207
208
209
210
211
212
    fontStyle_1 = tkFont.Font(family="Arial", size=14, weight="bold")
    fontStyle_2 = tkFont.Font(family="Arial", size=12, weight="bold")
    fontStyle_3 = tkFont.Font(family="Arial", size=10, weight="bold")
    fontStyle_c3 = tkFont.Font(family="courier", size=10, weight="bold")

    # ===================================================
    # ===================================================
    # Frame1. Acquisition button and image visu
    # ===================================================
    # ===================================================
72560278   Alain Klotz   Update of Ima cla...
213
    frame1 = tk.Frame(tkroot)
94c41643   Alain Klotz   Add schemes to TP...
214
215
216
217

    # ---
    frame101 = tk.Frame(frame1)
    frame101.pack(side = tk.TOP, fill=tk.X, expand=tk.NO)
72560278   Alain Klotz   Update of Ima cla...
218
219
220
    # ---
    widgets = {}
    # ---
94c41643   Alain Klotz   Add schemes to TP...
221
    frame101m = tk.Frame(frame101)
ecf46cbe   Alain Klotz   TP Audine
222
    # ---
94c41643   Alain Klotz   Add schemes to TP...
223
224
225
    photo_logo = ImageTk.PhotoImage(file='logo_iut_mp.png')
    label1 = tk.Label(frame101m, image=photo_logo)
    label1.image = photo_logo
ecf46cbe   Alain Klotz   TP Audine
226
227
    label1.pack(side = tk.LEFT, padx=2)
    # ---
a88e292a   aklotz   Add Combobox for ...
228
    var_method = tk.StringVar()
811f0a5f   aklotz   Add methods for T...
229
    var_method.set(methods[0])
94c41643   Alain Klotz   Add schemes to TP...
230
    label_method = tk.Label(frame101m, text="Method")
a88e292a   aklotz   Add Combobox for ...
231
    label_method.pack(side = tk.LEFT)
94c41643   Alain Klotz   Add schemes to TP...
232
    entry_method = ttk.Combobox(frame101m, textvariable=var_method, width=12)
811f0a5f   aklotz   Add methods for T...
233
    entry_method['values'] = methods
a88e292a   aklotz   Add Combobox for ...
234
235
236
237
    entry_method['state'] = 'readonly'
    entry_method.pack(side = tk.LEFT)
    #entry_method('<<ComboboxSelected>>', var_method)
    # ---
ecf46cbe   Alain Klotz   TP Audine
238
    var_exp = tk.DoubleVar()
b355c4be   aklotz   Fix bugs C code
239
    var_exp.set(0.0)
94c41643   Alain Klotz   Add schemes to TP...
240
    label_exp = tk.Label(frame101m, text="Temps de pose (s)")
ecf46cbe   Alain Klotz   TP Audine
241
    label_exp.pack(side = tk.LEFT)
94c41643   Alain Klotz   Add schemes to TP...
242
    entry_exp = tk.Entry(frame101m, width=4, textvariable=var_exp)
ecf46cbe   Alain Klotz   TP Audine
243
244
245
246
    entry_exp.pack(side = tk.LEFT)
    # ---
    var_bin = tk.IntVar()
    var_bin.set(1)
94c41643   Alain Klotz   Add schemes to TP...
247
    label_bin = tk.Label(frame101m, text="Binning")
ecf46cbe   Alain Klotz   TP Audine
248
    label_bin.pack(side = tk.LEFT)
94c41643   Alain Klotz   Add schemes to TP...
249
    entry_bin = tk.Entry(frame101m, width=4, textvariable=var_bin)
ecf46cbe   Alain Klotz   TP Audine
250
251
    entry_bin.pack(side = tk.LEFT)
    # ---
94c41643   Alain Klotz   Add schemes to TP...
252
    widgets["button_acq"] = tk.Button(frame101m, text="Acquisition", command=acquisition, padx=20, pady=20, font='sans 16 bold')
a312560d   aklotz   TP CCD
253
    widgets["button_acq"].pack(side = tk.LEFT, pady=5, padx=5)
ecf46cbe   Alain Klotz   TP Audine
254
    # ---
94c41643   Alain Klotz   Add schemes to TP...
255
    widgets["button_loadima_1"] = tk.Button(frame101m, text="Load FITS", command=ima1_load)
72560278   Alain Klotz   Update of Ima cla...
256
    widgets["button_loadima_1"].pack(side=tk.LEFT, padx = 2)
94c41643   Alain Klotz   Add schemes to TP...
257
    widgets["button_saveima_1"] = tk.Button(frame101m, text="Save FITS", command=ima1_save, state= tk.DISABLED)
72560278   Alain Klotz   Update of Ima cla...
258
    widgets["button_saveima_1"].pack(side=tk.LEFT, padx = 2)
94c41643   Alain Klotz   Add schemes to TP...
259
    frame101m.pack(side = tk.TOP, fill=tk.X, expand=tk.NO)
d5e4f9ca   Alain Klotz   platform for TP CCD
260

72560278   Alain Klotz   Update of Ima cla...
261
    # ---
94c41643   Alain Klotz   Add schemes to TP...
262
    frame102 = tk.Frame(frame1)
a312560d   aklotz   TP CCD
263
264
265
    # ---
    var['info'] = tk.StringVar()
    var['info'].set(infos['demarrer_acq'])
94c41643   Alain Klotz   Add schemes to TP...
266
    widgets["label_info"] = tk.Label(frame102, textvariable=var['info'], padx = 10)
a312560d   aklotz   TP CCD
267
    widgets["label_info"].pack(side = tk.LEFT)
94c41643   Alain Klotz   Add schemes to TP...
268
    frame102.pack(side = tk.TOP, fill=tk.X, expand=tk.NO)
d5e4f9ca   Alain Klotz   platform for TP CCD
269

72560278   Alain Klotz   Update of Ima cla...
270
271
    # --- Create and use a visu
    try:
94c41643   Alain Klotz   Add schemes to TP...
272
273
        frame101i = tk.Frame(frame1)
        visu1 = guitastro.Visu(frame101i)
72560278   Alain Klotz   Update of Ima cla...
274
        visu1.ima(ima1)
94c41643   Alain Klotz   Add schemes to TP...
275
        frame101i.pack(side = tk.TOP, fill=tk.BOTH, expand=tk.YES)
72560278   Alain Klotz   Update of Ima cla...
276
277
278
279
    except:
        msg = "{}".format(sys.exc_info())
        print(msg)

94c41643   Alain Klotz   Add schemes to TP...
280
281
282
283
284
285
286
287
288
    frame1.pack(fill=tk.Y, side = tk.LEFT, anchor=tk.NW)

    # ===================================================
    # ===================================================
    # Frame2. Display C code
    # ===================================================
    # ===================================================
    frame2 = tk.Frame(tkroot)

7c492583   Alain Klotz   Update TP CCD.
289
290
291
    label_code = tk.Label(frame2, text="C code run by the button Acquisition")
    label_code.pack(side = tk.TOP)

94c41643   Alain Klotz   Add schemes to TP...
292
293
294
295
296
297
298
299
300
301
302
303
304
    frame_display_code = tk.Frame(frame2)

    scrollbar = tk.Scrollbar(frame_display_code)
    text_code_txt = tk.Text(frame_display_code, height=15, wrap="word", yscrollcommand=scrollbar.set, font=fontStyle_3)

    scrollbar.config(command=text_code_txt.yview)
    scrollbar.pack(side=tk.RIGHT, fill=tk.Y)

    text_code_txt.tag_config('red', foreground="red")
    text_code_txt.tag_config('blue', foreground="blue")
    text_code_txt.tag_config('black', foreground="black")
    text_code_txt.tag_config('green', foreground="green")
    lignes = ""
7c492583   Alain Klotz   Update TP CCD.
305
306
307
308
309
310
    try:
        with open(var['c_code_filename'], "rt") as fid:
            lignes = fid.readlines()
    except:
        with open(var['c_code_filename_alt'], "rt") as fid:
            lignes = fid.readlines()
94c41643   Alain Klotz   Add schemes to TP...
311
312
313
314
315
316
    for ligne in lignes:
        text_code_txt.insert(tk.END, ligne, "blue")
    text_code_txt.yview_moveto(1.0)
    text_code_txt.pack(side = tk.TOP, padx=5, pady=1)
    frame_display_code.pack(side = tk.TOP, pady=5)

94c41643   Alain Klotz   Add schemes to TP...
317
318
319
320
321
    notebook = ttk.Notebook(frame2)
    tab201 = ttk.Frame(notebook)
    tab202 = ttk.Frame(notebook)
    tab203 = ttk.Frame(notebook)
    tab204 = ttk.Frame(notebook)
870400be   Alain Klotz   Add schemes to TP...
322
323
324
    tab205 = ttk.Frame(notebook)
    tab206 = ttk.Frame(notebook)
    tab207 = ttk.Frame(notebook)
94c41643   Alain Klotz   Add schemes to TP...
325
326
327
328

    # =====================================================
    # Tab 201 ==
    # =====================================================
870400be   Alain Klotz   Add schemes to TP...
329
330
331
332
333
334
335
336
337
    frame_display_ccdphase = tk.Frame(tab201)
    image = Image.open('true2phase_ccd.png')
    zoom = 1.2
    image_size = tuple([int(zoom * x)  for x in image.size])
    ccdphase_canvas = tk.Canvas(frame_display_ccdphase, width=image_size[0], height=image_size[1], relief=tk.RAISED, cursor="crosshair")
    ccdphase_image = ImageTk.PhotoImage(image.resize(image_size))
    ccdphase_canvas.create_image(0, 0, anchor = tk.NW, image = ccdphase_image)
    ccdphase_canvas.pack()
    frame_display_ccdphase.pack()
94c41643   Alain Klotz   Add schemes to TP...
338

870400be   Alain Klotz   Add schemes to TP...
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
    # =====================================================
    # Tab 202 ==
    # =====================================================
    frame_display_ccdtransf = tk.Frame(tab202)
    image = Image.open('ccd_transferts1.png')
    zoom = 2
    image_size = tuple([int(zoom * x)  for x in image.size])
    ccdtransf_canvas = tk.Canvas(frame_display_ccdtransf, width=image_size[0], height=image_size[1], relief=tk.RAISED, cursor="crosshair")
    ccdtransf_image = ImageTk.PhotoImage(image.resize(image_size))
    ccdtransf_canvas.create_image(0, 0, anchor = tk.NW, image = ccdtransf_image)
    ccdtransf_canvas.pack()
    frame_display_ccdtransf.pack()

    # =====================================================
    # Tab 203 ==
    # =====================================================
    frame_display_timing = tk.Frame(tab203)
94c41643   Alain Klotz   Add schemes to TP...
356
    image = Image.open('timing_diagram1.png')
b317eede   aklotz   Add schemes for T...
357
    zoom = 0.75
94c41643   Alain Klotz   Add schemes to TP...
358
    image_size = tuple([int(zoom * x)  for x in image.size])
870400be   Alain Klotz   Add schemes to TP...
359
    timing_canvas = tk.Canvas(frame_display_timing, width=image_size[0], height=image_size[1], relief=tk.RAISED, cursor="crosshair")
94c41643   Alain Klotz   Add schemes to TP...
360
    timing_image = ImageTk.PhotoImage(image.resize(image_size))
870400be   Alain Klotz   Add schemes to TP...
361
362
    timing_canvas.create_image(0, 0, anchor = tk.NW, image = timing_image)
    timing_canvas.pack()
94c41643   Alain Klotz   Add schemes to TP...
363
364
    frame_display_timing.pack()

94c41643   Alain Klotz   Add schemes to TP...
365
    # =====================================================
870400be   Alain Klotz   Add schemes to TP...
366
    # Tab 204 ==
94c41643   Alain Klotz   Add schemes to TP...
367
    # =====================================================
870400be   Alain Klotz   Add schemes to TP...
368
369
370
371
372
373
374
375
376
    frame_display_pins = tk.Frame(tab204)
    image = Image.open('pins_raspberry.png')
    zoom = 0.75
    image_size = tuple([int(zoom * x)  for x in image.size])
    pins_canvas = tk.Canvas(frame_display_pins, width=image_size[0], height=image_size[1], relief=tk.RAISED, cursor="crosshair")
    pins_image = ImageTk.PhotoImage(image.resize(image_size))
    pins_canvas.create_image(0, 0, anchor = tk.NW, image = pins_image)
    pins_canvas.pack()
    frame_display_pins.pack()
94c41643   Alain Klotz   Add schemes to TP...
377

870400be   Alain Klotz   Add schemes to TP...
378
379
380
381
    # =====================================================
    # Tab 205 ==
    # =====================================================
    frame_display_ccd = tk.Frame(tab205)
94c41643   Alain Klotz   Add schemes to TP...
382
    image = Image.open('ccd.png')
b317eede   aklotz   Add schemes for T...
383
    zoom = 0.65
94c41643   Alain Klotz   Add schemes to TP...
384
385
    image_size = tuple([int(zoom * x)  for x in image.size])
    ccd_canvas = tk.Canvas(frame_display_ccd, width=image_size[0], height=image_size[1], relief=tk.RAISED, cursor="crosshair")
b317eede   aklotz   Add schemes for T...
386
    ccd_image = ImageTk.PhotoImage(image.resize(image_size))
94c41643   Alain Klotz   Add schemes to TP...
387
388
389
390
391
    ccd_canvas.create_image(0, 0, anchor = tk.NW, image = ccd_image)
    ccd_canvas.pack()
    frame_display_ccd.pack()

    # =====================================================
870400be   Alain Klotz   Add schemes to TP...
392
    # Tab 206 ==
94c41643   Alain Klotz   Add schemes to TP...
393
    # =====================================================
870400be   Alain Klotz   Add schemes to TP...
394
    frame_display_ampli = tk.Frame(tab206)
94c41643   Alain Klotz   Add schemes to TP...
395
    image = Image.open('ampli.png')
b317eede   aklotz   Add schemes for T...
396
    zoom = 0.60
94c41643   Alain Klotz   Add schemes to TP...
397
398
    image_size = tuple([int(zoom * x)  for x in image.size])
    ampli_canvas = tk.Canvas(frame_display_ampli, width=image_size[0], height=image_size[1], relief=tk.RAISED, cursor="crosshair")
b317eede   aklotz   Add schemes for T...
399
    ampli_image = ImageTk.PhotoImage(image.resize(image_size))
94c41643   Alain Klotz   Add schemes to TP...
400
401
402
403
404
    ampli_canvas.create_image(0, 0, anchor = tk.NW, image = ampli_image)
    ampli_canvas.pack()
    frame_display_ampli.pack()

    # =====================================================
870400be   Alain Klotz   Add schemes to TP...
405
    # Tab 207 ==
94c41643   Alain Klotz   Add schemes to TP...
406
    # =====================================================
870400be   Alain Klotz   Add schemes to TP...
407
    frame_display_can = tk.Frame(tab207)
94c41643   Alain Klotz   Add schemes to TP...
408
    image = Image.open('can.png')
b317eede   aklotz   Add schemes for T...
409
    zoom = 0.65
94c41643   Alain Klotz   Add schemes to TP...
410
411
    image_size = tuple([int(zoom * x)  for x in image.size])
    can_canvas = tk.Canvas(frame_display_can, width=image_size[0], height=image_size[1], relief=tk.RAISED, cursor="crosshair")
b317eede   aklotz   Add schemes for T...
412
    can_image = ImageTk.PhotoImage(image.resize(image_size))
94c41643   Alain Klotz   Add schemes to TP...
413
414
415
    can_canvas.create_image(0, 0, anchor = tk.NW, image = can_image)
    can_canvas.pack()
    frame_display_can.pack()
94c41643   Alain Klotz   Add schemes to TP...
416
417
418
419

    # =====================================================
    # Pack frame of tabs
    # =====================================================
870400be   Alain Klotz   Add schemes to TP...
420
421
422
423
424
425
426
    notebook.add(tab201, text="CCD 2 phases")
    notebook.add(tab202, text="CCD transferts")
    notebook.add(tab203, text="Timings")
    notebook.add(tab204, text="Raspberry pins")
    notebook.add(tab205, text="CCD chip")
    notebook.add(tab206, text="Analogic output")
    notebook.add(tab207, text="CAN and multiplexer")
94c41643   Alain Klotz   Add schemes to TP...
427
428
429
430
431
    notebook.pack(fill = tk.Y)

    frame2.pack(fill = tk.Y, side=tk.LEFT, anchor="nw")

    # ===================================================
72560278   Alain Klotz   Update of Ima cla...
432
    # --- Launch the event loop of the user interface
94c41643   Alain Klotz   Add schemes to TP...
433
    # ===================================================
a312560d   aklotz   TP CCD
434
    tkroot.pack_propagate(0)
72560278   Alain Klotz   Update of Ima cla...
435
436
437
    tkroot.update()
    tkroot.mainloop()