I have been working on a GUI timer where time has to be given in the parameter. But the time can vary so I want to give the input from a text file.
The code is taken from the 1st answer.
Making a countdown timer with Python and Tkinter?
What I have tried:
f = open('f.txt', 'r')
data = f.read()
f.close()
print data
s = 'data'
self.countdown(s)
The f.txt file has a number 10.
But not working due to datatype and getting the error below:
Traceback (most recent call last):
File "new.py", line 33, in <module>
app = ExampleApp()
File "new.py", line 15, in __init__
self.countdown(s)
File "new.py", line 28, in countdown
self.label.configure(text="%d" % self.remaining)
TypeError: %d format: a number is required, not str
Any help would be appreciated.