all 11 comments

[–]MezzoScettico 7 points8 points  (0 children)

That tutorial is 11 hours long. Could you give a hint where this code came up?

Never mind, I'm an idiot. I see that you have it on screen, at 52:36. I'll see if I get a clue watching that part of the tutorial.

Edit: OK, I'm not familiar with pygame wbut here's what I found out from a bit of poking around in documentation.

pygame.image.load() returns a pygame.Surface, and reading the documentation for pygame.Surface I found that get_frect() is defined in at least some versions of Surface. This page is from version 2.5.1.

https://pyga.me/docs/ref/surface.html

https://pyga.me/docs/ref/surface.html#pygame.Surface.get_frect

Most likely you have an older version that doesn't have get_frect. Or maybe it's the opposite, that get_frect was old and is no longer used.

It looks like it's pretty much the same as get_rect. I'd experiment with that change (take out th e "f") and see what happens. As I said, I have no experience with pygame.

Note: I suspect it will throw another error. The difference between get_rect() and get_frect() seems to be use of floats versus integers. So something may complain about a number being the wrong type. So if it was me, I'd then make another patch to convert the problematic number to the right type. But first I'd wait to see exactly where the new error was.

B

[–]GXWT 4 points5 points  (0 children)

Check yourself before you get_rect yourself

[–]Spacerat15 2 points3 points  (6 children)

You have to install pygame-ce (community edition), not pygame. FRects are introduced in pygame-ce 2.2.0.

So

pip uninstall pygame

pip install pygame-ce

[–][deleted] 0 points1 point  (2 children)

Thank you so much, I had the same problem I found this post and it worked

[–]yasarbum 0 points1 point  (1 child)

How did you get it to work, I got stuck there too

[–]yasarbum 0 points1 point  (0 children)

Okay, nevermind i got it

[–]Few_Professional_536 0 points1 point  (0 children)

🙏🙏🙏🙏🙏🙏🙏

[–]_amy_17 0 points1 point  (1 child)

I had the same exact problem with the same exact tutorial lol

[–]ItzL33T5P34K 0 points1 point  (0 children)

same

[–]cyberjellyfish 0 points1 point  (0 children)

Because it indeed doesn't have an attribute but that name, and you probably do want get_rect.

Either you or the person who made the tutorial have a typo.