Python Forum
[Tkinter] rez = (mass / h) | ZeroDivisionError
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] rez = (mass / h) | ZeroDivisionError
#3
(Oct-20-2020, 04:18 AM)deanhystad Wrote: You are looking for a way to initialize entries in your form, but that was not the real problem. You should still fix your bmi calculation to check for a zero height instead of crashing. That is sloppy programming because there will be times when the program gets executed and the height is set to zero. But that isn't the real problem here. You should be wondering why the bmi function is being called even though you didn't press the calculate button. I bet there may be a problem with binding the bmi() function to the button

I cannot tell you how often I run into this same sort of thing working with professional programmers. You look where the program crashes thinking that is the problem. About half the time that is only where the program finally results in a program crash. The real problem may have happened in a different file and a different time, but it is hard to see past the stack trace to spot the real errant behavior. It is hard to see the forest for the trees.

I appreciate your feedback. I have only 1-2 months of experience with Python, small errors like this can't hold me for a few days till I find the solution, which is not the case with experinced programmers Smile
Reply


Messages In This Thread
rez = (mass / h) | ZeroDivisionError - by Maryan - Oct-20-2020, 02:22 AM
RE: rez = (mass / h) | ZeroDivisionError - by Maryan - Oct-20-2020, 05:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ZeroDivisionError: float division by zero Jionni 8 4,741 Feb-19-2020, 09:11 PM
Last Post: Jionni

Forum Jump:

User Panel Messages

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