How to Create a Menu in Pygame

How to Create a Menu in Pygame

Coding With Russ

3 года назад

129,004 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@NDNGR
@NDNGR - 06.06.2022 08:55

Sir can you make tutorial how to create 2d minecraft in python pygame

Ответить
@NDNGR
@NDNGR - 06.06.2022 08:56

Sir can you make tutorial how to add punch block and break block in python pygame

Ответить
@hazemhazem4619
@hazemhazem4619 - 09.06.2022 17:54

thank you ,,,,that's Great but I want to ask about (platformer game) ?

Ответить
@dubpper98
@dubpper98 - 15.06.2022 11:04

very nice men! thanks a lot

Ответить
@TiktokkGames
@TiktokkGames - 18.06.2022 23:01

Can you do a tutorial for a game who connect to tiktok live comments,donations,followers,likes and the game react to all descbribe,thank you !

Ответить
@pandazorrao458
@pandazorrao458 - 24.06.2022 02:01

Bro your channel is a hidden gem, awesome content

Ответить
@ToujoursIris
@ToujoursIris - 30.06.2022 01:26

New video?

Ответить
@dqew1664
@dqew1664 - 01.07.2022 00:24

when i press back it quits the application are u able to help please

Ответить
@justin7oo994
@justin7oo994 - 26.07.2022 12:37

Very nice tutorial I'm kinda new I followed some of your game tutorials and they are amazing I learnt so much and I also had a question what os do you use (i know its windows but just asking )

Ответить
@ratmadness4858
@ratmadness4858 - 09.08.2022 20:05

Thanks!!!

Ответить
@Tuff0
@Tuff0 - 27.08.2022 08:00

What happened to your website?
When I tried to access it, it says "Account suspended" even though I haven't done anything.

Ответить
@Ray-sb8qi
@Ray-sb8qi - 29.08.2022 22:26

keep getting an error "unident doesnt match with any other indentation level"

Ответить
@modnayashalava8212
@modnayashalava8212 - 02.09.2022 00:55

Man you're so damn good at explanation for real and only having 13k it's very undervalued :(

Ответить
@valeantigot6390
@valeantigot6390 - 11.09.2022 11:29

Hey, I enjoy watching your videos! Are you in audea btw..

Ответить
@danuzota2265
@danuzota2265 - 01.10.2022 23:10

thanks for the good video!👍

Ответить
@soop8765
@soop8765 - 12.11.2022 11:33

I dont get the ability to close the window even after putting in the exact same code as yourself. My window just stays locked open :/

Ответить
@dansassis6770
@dansassis6770 - 23.11.2022 20:04

Thank you very much for this tutorial, I was having a lot of trouble with this part. Clean and straight to the point.

Ответить
@IWIMugriwara
@IWIMugriwara - 06.12.2022 11:12

Hi Coding Russ, have been watching most of your tutorials. Right now I am trying to create a function to pause the game inside Pygame. Do you have a video on it or is there any way you can guide me on it? Much appreciated for all your help.

Ответить
@saitama9994
@saitama9994 - 25.12.2022 14:07

Awesome video. I have a little problem where my submenu buttons are in the exact same place as the menu button. When I click a menu button, the program goes through and also clicks the submenu button. Is there a way I can delay the click or something? I noticed that in this video, your buttons are not in the same place so that problem may have not come up.

Edit: I added a "clicked" check and it worked.

Ответить
@derar5555
@derar5555 - 27.12.2022 14:50

Hi there. Thanks a lot
I'm having trouble creating various menus with Pygame using your method, since some of the menu buttons, although on different menu screens, share the same coordinates. So once one gets pressed, the next screen detects the button still being pressed and automatically triggers as well.

Ответить
@usmanamjad1409
@usmanamjad1409 - 10.01.2023 19:49

thanks

Ответить
@tristandombroski9677
@tristandombroski9677 - 13.01.2023 04:45

Wait... So I don't even really need Tkinter for buttons? the first thing I noticed was no import for Tkinter. Wish I could find the tutorial I watched a few days ago and point the guy in this direction... I like the way you do buttons.

Ответить
@daviddedank
@daviddedank - 14.01.2023 13:54

the font.render just gives me an error saying "'str' object has no attribute 'render'"

Ответить
@Kubar38
@Kubar38 - 17.01.2023 16:41

For anyone having a problem such as buttons on the same coordinates in submenus gets automatically clicked, make a variable: clicked = False and set it to True whenever a button is clicked and make buttons clickable only if clicked is False. Set clicked back to False after the pygame.MOUSEBUTTONUP is triggered. For example:
if button.draw(screen) and not clicked: # if button.draw(screen) and clicked == False:
do_something()
clicked = True
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
clicked = False

Ответить
@alphamaine2714
@alphamaine2714 - 03.02.2023 03:12

where did you get the images from??

Ответить
@dgh25
@dgh25 - 14.03.2023 22:46

self.image.get_rect()

Ответить
@yzhkkhzy
@yzhkkhzy - 27.03.2023 06:45

Great video!

Ответить
@BccollioB
@BccollioB - 05.04.2023 21:53

If you alrready have a game for the code written, where would you add this code ? Thank u

Ответить
@暗号化
@暗号化 - 26.07.2023 07:24

Where is the code of Button Class??????😡😡😡

Ответить
@MrLOLYouTube
@MrLOLYouTube - 31.07.2023 21:46

Hi, I been trying to do this menu, but I got a black screen for some reason

Ответить
@charlesmendoza4660
@charlesmendoza4660 - 01.08.2023 23:53

nice tutorial i implement this paused menu to the tower defence game

Ответить
@nickda1
@nickda1 - 03.08.2023 16:58

how did you get that bar on the side of your screen on the python i have got its just a window with no menu bar at top all it says is the path i run it from

Ответить
@gutsjoestar7450
@gutsjoestar7450 - 07.08.2023 19:14

im here because when i tried this, my menu don't adjust to fullscreen, the rest is just blank white, i hope its explained in the video

Ответить
@Anonimo_por_escolha
@Anonimo_por_escolha - 19.09.2023 05:17

Video muito esclarecedor! Obrigado amiigo!

Ответить
@renn379
@renn379 - 23.11.2023 09:09

how and where should i put my game code? please help me

Ответить
@emiliaserra1333
@emiliaserra1333 - 22.12.2023 01:22

Hey, how about a character select menu? How can i make that?

Ответить
@zhizhideng
@zhizhideng - 08.04.2024 04:02

👏

Ответить
@greatpigeons4741
@greatpigeons4741 - 08.05.2024 10:34

This is really helpful but i keep running into a problem where it says:
resume_button = button.Button(304, 125, resume_img, 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Button.__init__() missing 2 required positional arguments: 'size_x' and 'size_y'

Any fixes?

Ответить
@OmongosCharlie
@OmongosCharlie - 09.05.2024 09:33

Ma dude you are an angel that helped me in my dark hour <3

Ответить
@anabolic_abuser69
@anabolic_abuser69 - 02.06.2024 01:38

hey! i wanted to bind "pause game" to escape instead of space because i use space to jump in my game, but escape is also the key that is used to exit the programme, atleast in vscode. so when i press escape, the menu appears for a single frame and then the game quits, do you know of a workaround to this?

Ответить
@AidenGriffin316
@AidenGriffin316 - 07.06.2024 01:01

NOTHING WORKS IN ANY OF THESE VIDEOS

Ответить
@loli-chan7146
@loli-chan7146 - 19.09.2024 16:03

Hey man, I might be late but I got something to ask. The else statement on game pause doesnt disappear on mine. You know any fixes?

Ответить
@xoxo.lxly._26
@xoxo.lxly._26 - 19.11.2024 21:19

hey can u tell me that how did you save that images? i am on IDLE on MacBook so please explain me how!

Ответить
@cantina_informatica
@cantina_informatica - 22.12.2024 17:08

thanks, even if two years passed this tutorial helps me

Ответить
@2much4skin
@2much4skin - 13.03.2025 00:03

what program do you use that you have maps with images? I write on IDLE? I don't see this function or something. This is day 2 in python for me...

Ответить