HOW TO MAKE A MENU SCREEN IN PYGAME!

preview_player
Показать описание
📑 SUMMARY
In this video, I show you how to make a Menu in PyGame and Python. I walk you through creating a Menu System in PyGame and show you how to create a GUI in PyGame by creating buttons in PyGame. I just said PyGame a bunch of times for the algorithm, by the way.

🔗 LINKS

⌚ TIMESTAMPS

0:00​ | Demo
0:55 | How to Use Multiple Screens in PyGame
2:05 | How to Make the GUI
4:35 | End

🎬 MY SETUP:
💻 PC: Custom Built:
✅ Intel Core i5-10400F
✅ Gigabyte NVIDIA GeForce GTX 1060 3 GB WINDFORCE OC
✅ Gigabyte B560M DS3H AC
✅ G-Skill Ripjaws V DDR4-3200MHz CL16 RAM (2x8 GB)
✅ DeepCool MACUBE 110 Micro-ATX Case
✅ Western Digital Blue SN550 500 GB NVMe SSD
✅ EVGA 500 BR 80+ Bronze Power Supply
⌨️ Keyboard: Razer Huntsman Gaming Keyboard (Razer Opto-Mechanical Purple Switches)
🖥️ Monitor: ASUS VP228 21.5” 1080p 75Hz
🖱️ Mouse: VicTsing 2.4GHz Wireless Mouse
🎙️ Mic: Blue Yeti USB Condenser Microphone
💻 Secondary Laptop/Monitor: Dell Inspiron 11-3185 2-in-1

🎵 MUSIC

Track: Autumn — KV [Audio Library Release]
Music provided by Audio Library Plus

🏷️ TAGS
- PyGame
- Menu in PyGame
- Multiple Screens in PyGame

Hashtags:
#Python #PyGame #MenuSystem
Рекомендации по теме
Комментарии
Автор

This guy really just answered my question with a single sentence after the most consice and informative one-minute introduction I've seen in a long time. Why didn't I think of making multiple game loops? Thank you, subscriber earned :D

alphachrome
Автор

My guy literally replied to every comment! By the way, very well explained the multiple loops really helped out!

rudraneelmandal
Автор

Simple and quick to the point. This is exactly what we need in the education system. I never expected that at the age of 21 I would be learning from a 14-year-old (I mean, if you're 16 now, you'll be 14 then, hah), but you have to learn from everyone, regardless of age.

There's a sub and a symbolic amount. I hope,
that you will have a wonderful day and that I will see more of you at such a high level as the mountains in Nepal!Simple and quick to the point. This is exactly what we need in the education system. I never expected that at the age of 21 I would be learning from a 14-year-old (I mean, if you're 16 now, you'll be 14 then, hah), but you have to learn from everyone, regardless of age.

There's a sub and a symbolic amount. I hope,
that you will have a wonderful day and that I will see more of you at such a high level as the mountains in Nepal!

WiatrusPL
Автор

Thank you for this tutorial, this helped a lot. Your code made a big difference to the game I built.

Kgotso_Koete
Автор

Amazing tip on how to use multiple screens! I had a big issue with having different resolutions for my main menu and gameplay and this really helped. Thanks a lot!

yarin
Автор

This is one of the greatest pieces of media of all time

trexking
Автор

Very understandable and simple tutorial. you got a sub

sureshmedicalstore
Автор

I don't know which is better, but I don't have several functions for scenes but I use a "scene" string variable which I use in if statements so that the game doesn't render everything

AndrasBalintBoroczky
Автор

your voice changed a lot from the button video to this one, thanks for the vids

samhonor
Автор

Dude this is what i was looking for thank you✴

Alaaja_aj
Автор

Should not you use a break to exit the While loop before calling the next "window"?
Otherwise you keep nesting the next iteration of each while loop you enter ad infinitum.
I'll gladly stand corrected if I'm proved wrong (I'm not an expert programmer).

serolrom
Автор

If you're creating a button instance inside the while loop, doesn't that just replace the button instance from the previous loop with the newly created button from the current loop? Or keep adding buttons to memory? I haven't ran code or anything yet but I'll test it as soon as I can. Thanks!

dasshaker
Автор

i didn't know it's just that simple. thanks for tutorial

MeHdi.fz
Автор

Hi, I'm having difficulties trying to implement this into my game. It's telling me this: 'local variable 'button' referenced before assignment'. I know you have the button class in a separate place than the rest of the code, but since I'm using the default IDLE I'm not sure if I can do that. Also, the button class is written before the main_menu() function.

nottsninja
Автор

Thanks for your help. I´m new in python and your video helps me a lot. One single question: to run my game, do I have to put the game code inside the play menu?

raulalelupaz
Автор

So then the game logic and main game loop goes in the play method? Or should it be in a separate file that’s called when play is clicked?

MegaNewmoonfan
Автор

It worked so well, thank you for the video! Im just a little confused about how and where i should put my game code, is it inside the play function?

juliagomes
Автор

Hey! I was just wondering what software your using and whether it has a MacOS alternative! Thanks

sebastiantaylor
Автор

Thanks for this tutorial! Now I can add that to my game

gamalielgerona
Автор

Nice foundation to scale application, have concearns related to calling_main_menu from play or from option,
smells like recursion, where you go deeper and deeper, into stack
though it can be easily fixed by return keyword

python_decoded