-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ethan Friedman
committed
Dec 6, 2019
1 parent
b41c83b
commit 135a0fd
Showing
2 changed files
with
42 additions
and
25 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 |
---|---|---|
@@ -1,12 +1,23 @@ | ||
import tkinter as tk | ||
import os | ||
#This runs the times.py and makes a GUI that updates every n milliseconds. | ||
import tkinter as tk #imports GUI package | ||
import os # allows you to run commands in command line from a line of code. | ||
|
||
n = 1000# <-- change this value to change update time (ms) | ||
#Update Function | ||
def update(): | ||
#set output of times.py to var so I can call later | ||
times = os.popen('python times.py').read() | ||
#set times to a string | ||
l.config(text=str(times)) | ||
root.after(1000, update) | ||
|
||
#Main update function for GUI | ||
root.after(n, update) | ||
# define GUI properties and display it | ||
root = tk.Tk() | ||
#Label GUI | ||
l = tk.Label(text='Train Times:') | ||
#Pack info to be displayed | ||
l.pack() | ||
root.after(1000, update) | ||
#update after defined number of milliseconds | ||
root.after(n, update) | ||
#start GUI | ||
root.mainloop() |
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