Python 3.4 ctypes message box doesn't open with other code included
Question: Normally this code works fine when called.

    
    
    import ctypes
    
    def message_box(title, text):
        ctypes.windll.user32.MessageBoxW(0, text, title, 1)
    

But when it's used with other code it hangs at the line where message_box is
called.

    
    
    import ctypes
    
    def message_box(title, text):
        ctypes.windll.user32.MessageBoxW(0, text, title, 1)
    
    while True:
        time = input("Enter time of the reminder in the format 'HH:MM': ")
        if (len(time) != 5):
            print("\nInvalid answer\n")
            continue
        if (time[2] != ":"):
            print("\nInvalid answer\n")
            continue
        try:
            hours = int(time[0:2])
            minutes = int(time[3:5])
        except:
            print("\nInvalid answer\n")
            continue
        if not (0 < hours < 23 or 0 < minutes < 59):
            print("\nInvalid answer\n")
            continue
        break
    
    message_box("Example_title", "Example_text")
    


Answer: I found how to do it.

In the fourth argument for the message box, you need to put in values
separated by pipes ('|'). From my limited testing, the MB arguments define the
buttons that the user can click, apart from MB_SYSTEMMODAL which brings the
window to the front. The ICON arguments define what noise the window makes as
it pops up as well as a little image in the window denoting its purpose.

    
    
    MB_OK = 0x0
    MB_OKCXL = 0x01
    MB_YESNOCXL = 0x03
    MB_YESNO = 0x04
    MB_HELP = 0x4000
    MB_SYSTEMMODAL = 4096
    ICON_EXCLAIM = 0x30
    ICON_INFO = 0x40
    ICON_STOP = 0x10
    
    def message_box(title, text):
        ctypes.windll.user32.MessageBoxW(0, text, title, MB_OK | ICON_INFO | MB_SYSTEMMODAL)
    

