Jan-26-2021, 06:14 PM
I am only days new to python so please bear with me.
The issue I think I am running into is that when I launch the script, python immediately gets the entry which is nothing at launch. I want to input an entry for the # of days for the rental and than get that and create a calculation so I can output the cost on the screen.
Any help would be much appreciated.
The issue I think I am running into is that when I launch the script, python immediately gets the entry which is nothing at launch. I want to input an entry for the # of days for the rental and than get that and create a calculation so I can output the cost on the screen.
Any help would be much appreciated.
from tkinter import * root = Tk() #Welcome message welcome_label = Label(root, text="Overlander Sports Rental Form") welcome_label.grid(row=1, column=2) #Entry line for employee name ename = Entry(root) ename.grid(row=2, column=2) #Label for employee entry line ename_label = Label(root, text="Employee Name: ") ename_label.grid(row=2, column=1) flname = Entry(root) flname.grid(row=3, column=2) flname_label = Label(root, text="Renter's Name: ") flname_label.grid(row=3, column=1) rental_period = Entry(root) rental_period.grid(row=4, column=2) rental_period_label = Label(root, text="Renting for # of days: ") rental_period_label.grid(row=4, column=1) def myclick(): mylabel = Label(root, text="Saved!") mylabel.grid(row=5, column=3) test_renter = open("test_file", "w") test_renter.write("Employee Name: " + ename.get()) test_renter.write("\n") test_renter.write("Renter's Name: " + flname.get()) test_renter.write("\n") test_renter.write("Renting for: " + str(rental_period.get()) + " days") test_renter.write("\n") rental_period.get() print(rental_period) test_renter.close() save_button = Button(root, text="Save", command=myclick, fg="blue") save_button.grid(row=5, column=2) root.mainloop()