sexta-feira, 2 de setembro de 2022

Tkinter mensagens

 import tkinter.messagebox

from tkinter import *

windows=Tk()

# Let's create a alert box with 'messagebox' function

tkinter.messagebox.showinfo("Alert Message", "This is just a alert message!")


# Let's also create a question for the user and based upon the response [Yes or No Question] display a message.

response = tkinter.messagebox.askquestion("Tricky Question", "Do you love Deep Learning?")

print(response)

# A basic 'if/else' block where if user clicks on 'Yes' then it returns 1 else it returns 0. For each response you will display a message with the help of 'Label' method.

if response == 'yes':

    tkinter.Label(windows, text = "Yes, offcourse I love Deep Learning!").pack()

else:

    tkinter.Label(windows, text = "No, I don't love Deep Learning!").pack()


windows.mainloop()


Nenhum comentário:

Postar um comentário

Observação: somente um membro deste blog pode postar um comentário.