Hello! I'm fairly new to Python. Hopefully you can understand what I'm trying to accomplish here. I'm making a GUI that prints Parking Garage Tickets. I want to be able to post an expiration date on the ticket. I found out about timedelta, and it works if I put in, for example, datetime.timedelta(days=4). However, in my program, I have an entry box that allows the user to enter how many days they will be parking for. Is there a way to make timedelta accept a variable in between the parentheses? For example: timedelta(days=n), where n is the amount of days the user entered.
Here is what I have so far:
today = datetime.date.today()
future = datetime.timedelta(days=4)
expire = today + future
date = Text(Point(250,185), expire)
date.setFill("blue")
date.draw(win)
If someone could please show me how to make it so that timedelta accepts a variable instead of a literal number? Thanks.. let me know if you need more information.