help please fix the script

import tkinter import sys def yesNo(title, message): if tkinter.messagebox.askyesno(title, message): result = True else: result = False return result if yesNo("Exit", "Do you want to quit?"): print('t') sys.exit() else: print('f') input() 

after launching from IDLE and clicking a button in the askyesno dialog, the console displays "t" or "f". however, exit from the program does not occur (that is, the sys.exit () instruction is not executed)

If this code is run in windows7 from the total commander by double clicking on the file name, then the console's black screen is displayed for a split second and closes.

    1 answer 1

     root.destroy() 

    Upd.

    And if so:

     from tkinter import messagebox ... if messagebox.askyesno(title, message): ... 
    • So there is no root then. myself would be happy ... - cyklop77 February
    • Try running the script from the console, see what it is writing. - WorldCount