Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Errors in code
#1
Hi,

I've been trying to figure out what I need to edit in this code to make it run properly. I wasn't sure where to post this in the forums so just decided to make a new post. Any help with this is definitely appreciated.


from Tkinter import * # import everything from the Tkinter GUI framework def calculate_age() # calculate the pay and display
global age# global variable called pay e1.focus_set( e2=Label(master, text="No Age Calculated ").grid(row=2,column=0) days= 365*float(e1.get()
e2=Label(master, text=" ".grid(row=2,column=0)
e2=Label(master, text="Age in days is +str(days)).grid(row=2,column=0 e1.delete(0,'end')
def close_window() # close menu window and stop program master.destroy()
master = Tk(
Label(master, text="Enter your age in years:").grid(row=0) Label(master, text="Your age in days is ").grid(row=2)
e1 = Entry(master)
e2 = Label(master)
e1.grid(row=0, column=1)
e2.grid(row=1, column=1
# Buttons
Button(master, text='Calc', command=calculate_age).grid(row=4, column=1, sticky=W, pady=4)
Button(master, text='Quit', command=close_window).grid(row=4, column=0, sticky=W, pady=4) Master.geometry("350,200"
master.title("AssessErrors")
#mainloop( )
Master.destroy()
Quote
#2
Couple things:
Firstly, what have you tried in making it work?
Secondly, where in the world did you get this code from? There are so many problems.

Have a try at fixing it yourself - it's not as bad as it seems.
Code:
Quote
#3
(Dec-02-2019, 03:18 PM)DreamingInsanity Wrote: Couple things:
Firstly, what have you tried in making it work?
Secondly, where in the world did you get this code from? There are so many problems.

Have a try at fixing it yourself - it's not as bad as it seems.
Code:

I'm new to Python so some of the code I've written myself and some I've had to search for on Google. I think I've mixed a few things up so that is probably why I've had so many problems. I've tried to space the code out and comment out individual lines to fix it. My problem I think was it was trying to do too many things. I think I'll be fine with it now. Thank you for at least having a look at it though, really appreciate it.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Errors trying to run code ziggyztz 3 199 Nov-03-2019, 04:24 AM
Last Post: newbieAuggie2019
  errors in code sylvie1987100 3 299 Sep-11-2019, 12:54 PM
Last Post: sylvie1987100
  Decorator toy code throws syntax errors kevinxhi 3 931 Sep-04-2017, 03:01 AM
Last Post: kevinxhi

Forum Jump:


Users browsing this thread: 1 Guest(s)