+ 1

Pygame

Hey there it has been a >3weeks since I learned python & made some games like: 1)guess the number 2)a choice based game 3)tic tac toe I want to advance in & learn GUI with python.I had been learning pygame but when it came to insert some images in the game I was confused.I don't know how to get to the images and do all the stuff of loading. My android IDE namely pyroid3 don't support that.I changed my IDEs but it didn't work.Now I am frusted to code in python because I can't to get on the GUI beyond the CLI.Plz help me suggest me all what you know. Plz help me

2nd Jun 2024, 8:20 AM
Aryan Kadam
Aryan Kadam - avatar
5 ответов
+ 3
Where are you learning to insert images? What does it say and what does your code look like?
2nd Jun 2024, 12:00 PM
Ausgrindtube
Ausgrindtube - avatar
+ 3
Maybe this will help you: https://stackoverflow.com/questions/29662908/how-do-i-blit-an-image-to-a-surface-in-pygame-thats-the-same-size-as-a-rectangl But I don't know about the limitations of PyDroid. It would be much easier to do this on a PC with the support of a proper IDE / editor, such a as Visual Studio Code, or Pycharm.
2nd Jun 2024, 6:51 PM
Tibor Santa
Tibor Santa - avatar
+ 2
make a folder named imagesto store your image files in your project folder and find or make the images you want to use in your game.
4th Jun 2024, 12:40 AM
Zaim Aalam
Zaim Aalam - avatar
+ 1
I'm not that familiar with developing on a smartphone, but I'd say it has its limitations. It should work with a PC/laptop if that's an option. Otherwise it could get very complicated.
2nd Jun 2024, 11:59 AM
Stefanoo
Stefanoo - avatar
+ 1
I have been learning from YouTube. #converting a CLI to GUI #pygame-creating a boring GUI programming and more import pygame,sys from pygame.locals import* pygame.init() display_surface=pygame.display.set_mode((400,300)) pygame.display.set_caption('AK') clock=pygame.time.Clock() test_surface=pygame.Surface((250,250)) test_surface.fill('Red') while True: for events in pygame.event.get(): if events.type==QUIT: pygame.quit() sys.exit() display_surface.blit(test_surface,(50,50))#blit stands for block image transform pygame.display.update() clock.tick(60)#60FPS Instead of those plane colours I want to insert some cool images but it isn't that easy to load them
2nd Jun 2024, 12:12 PM
Aryan Kadam
Aryan Kadam - avatar