Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Fu - Math operations failing
#2
scaleFactor = int(maxSize) / int(currentWidth) is returning zero because you're doing integer arithmetic. You need to make one or both into float values to get a fractional scaleFactor

Code:
> > > int(512) / int(258)
1
> > > int(512) / float(258)
1.9844961240310077
Reply


Messages In This Thread
RE: Python Fu - Math operations failing - by Kevin - 01-31-2023, 09:56 AM

Forum Jump: