S
S
szafranji2020-05-19 15:52:49
Python
szafranji, 2020-05-19 15:52:49

Customize the game menu?

Hello.
I'm making a text game in python and started making the main menu when I enter the game.
When you press the "START GAME" button, I import a file with the main interface, where you can already play. And after import I close the file with the menu. But for some reason in action it looks like this:
-I press START GAME
-The file with the main interface is imported, but the screen is black -The file with the
main menu is not closed.
Why is that?

def menu_clicked(event):                                                                                                   
    index_result = main_menu.curselection()                                                                                     
    result = main_menu.get(index_result)                                                                                     
    if(result == "НАЧАТЬ ИГРУ"):                                                                                               
        import main_gui                                                                                                     
        root.destroy()                                                                                                       
    elif(result == "ВЫХОД"):                                                                                              
        root.destroy()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheAngryPython, 2020-05-19
@szafranji

def menu_clicked(event):                                                                                                   
    index_result = main_menu.curselection()                                                                                     
    result = main_menu.get(index_result)                                                                                     
    if(result == "НАЧАТЬ ИГРУ"):                                                                                                     
        root.destroy()                                                                                                                  
        import main_gui                                                                                    
    elif(result == "ВЫХОД"):                                                                                              
        root.destroy()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question