Sep-03-2022, 11:35 AM
(This post was last modified: Sep-03-2022, 08:36 PM by Yoriz.
Edit Reason: Added prefix
)
Hello all,
I'm trying to create a simple GUI interface with tkinter using a simple strokes calculator based on an user input. My simple code is below, but I cannot discover how to plot this on the tkinter interface. Could you guys help me on that?
I'm trying to create a simple GUI interface with tkinter using a simple strokes calculator based on an user input. My simple code is below, but I cannot discover how to plot this on the tkinter interface. Could you guys help me on that?
from time import sleep a = int(input('What is the total Drillstring SPM:')) stroke_rate = a # strokes/min stroke_sec = (round((stroke_rate / 60), 2)) stroke_count = 0 run = True while run == True: stroke_count += stroke_sec print(str(stroke_count) +' STROKES') sleep(1)And this was what I tried, but did not work:
from tkinter import * from time import sleep root = Tk() root.title("Strokes Counter") root.resizable(False, False) def click_button(): stroke_rate = ed1.get() stroke_count = 0 run = True while run == True: stroke_count += stroke_rate sleep(1) lb2 = Label(root, print(str(stroke_count) +' stk')) lb2.grid(row=3, column=0) lb1 = Label(root, text="What is the SPM: ") lb1.grid(row=0, column=0) ed1 = Entry(root) ed1.grid(row=0, column=1) bt1 = Button(root, text="Confirm", command=click_button) bt1.grid(row=2, column=0) root.geometry("300x100") root.mainloop()Thanks in advance, guys!