Python Forum
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()
Reply
#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:
Reply
#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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  code not running even without errors Azdaghost 2 321 Apr-25-2025, 07:35 PM
Last Post: Azdaghost
  Are there errors in the code for my coin toss systems? Matlibplot is too perfect . Coolkat 0 898 Nov-13-2023, 11:54 AM
Last Post: Coolkat
  My code won't say Player wins or computer wins. No errors. its_a_meLuigi64 2 2,372 Dec-01-2021, 04:43 PM
Last Post: its_a_meLuigi64
  Rmarkdown opened by python code - errors Rav013 0 2,692 Apr-27-2021, 03:13 PM
Last Post: Rav013
  [split] Kera Getting errors when following code example Image classification from scratch hobbyist 3 5,615 Apr-13-2021, 01:26 PM
Last Post: amirian
  2 errors in code numbnumb54 2 2,795 Jul-24-2020, 02:28 PM
Last Post: Marbelous
  Code errors rhyjom 0 1,943 Jun-21-2020, 04:50 PM
Last Post: rhyjom
  Errors trying to run code ziggyztz 3 5,028 Nov-03-2019, 04:24 AM
Last Post: newbieAuggie2019
  errors in code sylvie1987100 3 3,109 Sep-11-2019, 12:54 PM
Last Post: sylvie1987100
  Decorator toy code throws syntax errors kevinxhi 3 4,480 Sep-04-2017, 03:01 AM
Last Post: kevinxhi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020