Please could you explain how to use tkinter to make an Entry
widget that passes a percentage value to the function below e.g. the user enters 60
into the input field which then passes the user’s value to the percent = 55
argument so it updates in real time to whatever value the user types in?
def reset(percent=55):
prob = random.randrange(0,100)
if prob > percent:
return True
else:
return False
print(reset(15))
N.B Matplotlib, random and NumPy are being imported.
Tried using the input(), int() and str() functions but the IDLE still produces errors. Editing the 'percent=' argument too much causes the program to crash.
The 'percent=' argument only seems to accept the format: percent=number
reset("60")
notreset(60)
, passing a sting not a numeric? If it is, there needs to be a function that converts anything the user can enter into theEntry
into an acceptableint
before passing it toreset
.