From 05bad3c7b22596c9467c6912c42af9044cffe4a9 Mon Sep 17 00:00:00 2001 From: xaloc Date: Wed, 15 Jan 2020 21:19:23 +0100 Subject: [PATCH] fix test_gui now prints the settings list --- test_gui.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test_gui.py b/test_gui.py index 299a619..f6aed87 100644 --- a/test_gui.py +++ b/test_gui.py @@ -2,37 +2,37 @@ import tkinter as tk w = tk.Tk() -p_name = tk.StringVar(w) -cpus = tk.StringVar(w) -cyc = tk.StringVar(w) -N_ts = tk.StringVar(w) -T_cyc = tk.StringVar(w) - -def getvars(p_name, cpus, cyc, N_ts, T_cyc): - p_name = p_name.get() - cpus = cpus.get() - cyc = cyc.get() - N_ts = N_ts.get() - T_cyc = T_cyc.get() - - print(T_cyc) +p_nameVar = tk.StringVar(w) +cpusVar = tk.StringVar(w) +cycVar = tk.StringVar(w) +N_tsVar = tk.StringVar(w) +T_cycVar = tk.StringVar(w) +settings = 0 +def getvars(): + p_name = p_nameVar.get() + cpus = cpusVar.get() + cyc = cycVar.get() + N_ts = N_tsVar.get() + T_cyc = T_cycVar.get() + settings = (p_name, cpus, cyc, N_ts, T_cyc) + print(settings) field1 = tk.Label(w, text="project name").grid(row=0, column=0) -entry1 = tk.Entry(w, textvariable = p_name).grid(row=0, column=1) +entry1 = tk.Entry(w, textvariable = p_nameVar).grid(row=0, column=1) field2 = tk.Label(w, text="CPUs").grid(row=1, column=0) -entry2 = tk.Entry(w, textvariable = cpus).grid(row=1, column=1) +entry2 = tk.Entry(w, textvariable = cpusVar).grid(row=1, column=1) field3 = tk.Label(w, text="number of cycles").grid(row=2, column=0) -entry3 = tk.Entry(w, textvariable = cyc).grid(row=2, column=1) +entry3 = tk.Entry(w, textvariable = cycVar).grid(row=2, column=1) field4 = tk.Label(w, text="number of time steps").grid(row=3, column=0) -entry4 = tk.Entry(w, textvariable = N_ts).grid(row=3, column=1) +entry4 = tk.Entry(w, textvariable = N_tsVar).grid(row=3, column=1) field5 = tk.Label(w, text="cycle periode").grid(row=4, column=0) -entry5 = tk.Entry(w, textvariable = T_cyc).grid(row=4, column=1) +entry5 = tk.Entry(w, textvariable = T_cycVar).grid(row=4, column=1) -button = tk.Button(w, text="Get vars", command=getvars(p_name, cpus, cyc, N_ts, T_cyc)).grid(row=5) +button = tk.Button(w, text="Get vars", command=getvars).grid(row=5) w.mainloop()