def begin(x): a = 1 b = len(getData()) msg = getData() for i in getData(): # j =str(i) # print(msg[j]) # t=tk.Text(window,width=10,height=1,font=ft) d = tk.Text(window, width=5, height=1, font=ft) #print(i) d.bind("<Key>", lambda a: ctrlEvent) d.insert("insert", msg[i]) d["state"] = 'disabled' l = tk.Label(window, text=i, width=10, height=1) # t.grid(row=i,column=1) if a <= b: l.grid(row=1, column=a, padx=8, pady=4) d.grid(row=2, column=a, padx=8, pady=4) a += 1 if x == 1: d["state"] = 'normal' d.delete(0.0, tk.END) for j in getData(): d.insert("insert", msg[i]) d.update() d["state"] = 'disabled' else: bt2 = tk.Button(window, text='更新', width=5, height=1, command=new) bt2.grid(row=4, column=int(len(getData()) / 2) + 2, padx=20, pady=20) fun()
def rec(): for i in getData(): h, m = getTime(i) curr_time = datetime.datetime.now() + datetime.timedelta(seconds=-7) if curr_time.hour == h and curr_time.minute == m and i in getData(): print("时间到" + str(datetime.datetime.now())) return 1 print(i + str(curr_time)) print("------------------------" + "\n")
def viewGraph(fileType): # get data for associated fileType fileTypeData = getData()[fileType] # Setup plot settings. Excludes Millis as a plot fig, ax = plt.subplots(len(fileTypeData) - 1, 1, sharex=True) # Do not remove assignment. Removal will cause object to be disposed ani = animation.FuncAnimation(fig, _animate, fargs=(ax, fileType, fileTypeData, readStreamData), interval=1000) plt.show()
def getTime(i): data = getData() thing = json.dumps(data, cls=MyJSONEncoder) a = json.loads(thing, object_hook=object_hook) y = a[i] #print(y) time = datetime.datetime.strptime(y, "%H:%M") #time = thing['thing'] return time.hour, time.minute
def out(): window.destroy() oo = os.getpid() import subprocess subprocess.Popen("cmd.exe /k taskkill /F /T /PID %i" % oo, shell=True) # print(os.getpid()) def go(): begin(0) def mixed_action(btn): go() btn["state"] = 'disabled' bt = tk.Button(window, text='启动', width=8, height=1) bt.config(command=lambda: mixed_action(bt)) bt.grid(row=4, column=int(len(getData()) / 2) - 2, padx=20, pady=20) #bt2 = tk.BugetDataon(window, text='设置', width=5, height=1, command=config) #bt2.grid(row=4, column=4, padx=20, pady=20) window.protocol("WM_DELETE_WINDOW", out) window.mainloop()
import sys from Data import getData from PlotData import viewGraph if len(sys.argv) != 2: print("Invalid number of inputs! Only include 1 file type.") sys.exit() else: input = sys.argv[1] for header in getData(): if input == header: viewGraph(input) sys.exit() print("Wrong file type! Check input.")