1

I want to print the runtime with seconds string. But this code is not working.

runTime = StringVar()
RT = Label(window, textvariable=runTime, text="seconds")
RT.pack()

Output :

0.00985...

I want to change the output into :

0.00985... seconds

3 Answers 3

1

try like this ,

runTime = StringVar()
RT = Label(window, textvariable=runTime)
RT.pack()

runtime.set(str(<your time variable>)+'seconds')
Sign up to request clarification or add additional context in comments.

Comments

1

Both answers are wrong. This is how it is supposed to be done:

time = tk.IntVar()
time.set(5)

runTime = tk.StringVar()

runTime.set(str(time .get()) + ' seconds')

Comments

-1

(Way to late) Try this

runTime = ""
RT = Label(window, text=runTime + "seconds")
RT.pack()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.