-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from gaz20004/prototype
Basic prototype with support for selecting chip and simulating a test
- Loading branch information
Showing
6 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import tkinter as tk | ||
import os | ||
from time import sleep | ||
|
||
def get_files(path): | ||
files = [] | ||
for file in os.listdir(path): | ||
if os.path.isfile(os.path.join(path, file)): | ||
if file.endswith(".txt"): | ||
files.append(file.replace(".txt", "")) | ||
return files | ||
|
||
def start_test(): | ||
to_test = clicked.get() | ||
print(f"Testing {to_test}") | ||
label_test_status.config(text=f"Starting test of {to_test}") | ||
label_test_status.config(text=f"Test of {to_test} complete") | ||
f = open("../test_results" + os.sep + "test_results_" + to_test + ".txt", "w") | ||
f.write("Test results for " + to_test + "\n") | ||
f.close() | ||
|
||
|
||
# Create the main window | ||
root = tk.Tk() | ||
root.title("Frontend Prototype") | ||
|
||
root.geometry("400x400") | ||
|
||
def show(): | ||
label.config(text= clicked.get()) | ||
|
||
options = get_files("../test_chips") | ||
|
||
clicked = tk.StringVar() | ||
clicked.set(options[0]) | ||
|
||
# Create a dropdown menu | ||
drop = tk.OptionMenu(root, clicked, *options) | ||
drop.pack() | ||
|
||
button = tk.Button(root, text="Select", command=show).pack() | ||
|
||
# Create a label widget | ||
label = tk.Label(root, text="Select a circuit to test") | ||
label.pack() | ||
|
||
# Button to start test | ||
button_test = tk.Button(root, text="Start Test", command=start_test) | ||
button_test.pack() | ||
|
||
label_test_status = tk.Label(root, text="Click 'Start Test' to begin testing") | ||
label_test_status.pack() | ||
|
||
# Run the application | ||
root.mainloop() |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Test results for hexconverter |