Does anyone know how to fix this error?

I am making a game in pycharm but i did came across a code that says: SyntaxError : invalid syntax
Does anyone know how to fix this?

Hey @amel8star welcome to the forums!

See this guide on how to share your code:

PS: if you cannot edit your post, please read around a little to increase your trust level and let you access editing your posts.

Or

Please share your code so we can take a look at it.

```languagename
Your code here
```

So that it is easier for staff and members of the community to help you with your issue!

Im sorry I did the post in a hurry. Here is the code:


import pygame


pygame.init()
Screen = width,height = 288, 512

info = pygame.display.Info()
width = info.current.w
height = info.current_h

if width >= height:
    win =  pygame.display.set_mode(Screen)
else:
    win = pygame.display.set_mode(Screen, pygame.SCALED, pygame.)

@amel8star can you try this:

import pygame

pygame.init()
Screen = width, height = 288, 512

info = pygame.display.Info()
width = info.current_w  # Corrected the attribute name
height = info.current_h

if width >= height:
    win = pygame.display.set_mode(Screen)
else:
    win = pygame.display.set_mode(Screen, pygame.SCALED)

And/or this:

import pygame

pygame.init()
Screen = width, height = 288, 512

info = pygame.display.Info()
width = info.current_w
height = info.current_h

if width >= height:
    win = pygame.display.set_mode(Screen)
else:
    win = pygame.display.set_mode(Screen)

It did work now, I didnt get the error. Thank you a lot!

@amel8star You’re welcome! I’m glad I could help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.