1
from tkinter import *
class Application:
def __init__(self, master=None):
self.inicio = Frame(master)
self.inicio.pack()
self.msg = Label(self.inicio, text="Deseja exprimentar a versao input?")
self.msg["font"] = ("Calibri", "9", "italic")
self.msg.pack ()
self.sim = Button(self.inicio)
self.sim["text"] = "sim"
self.sim["font"] = ("Calibri", "9")
self.sim["width"] = 10
self.sim.bind("<Button-1>", self.Verificar)
self.sim.pack ()
self.nao = Button(self.inicio)
self.nao["text"] = "nao"
self.nao["font"] = ("Calibri", "9")
self.nao["width"] = 10
self.nao.bind("<Button-2>", self.Verificar)
self.nao.pack ()
def Verificar(self, event):
if self.msg["text"] == "Deseja exprimentar a versao input?":
self.msg["text"] = "Bem vindo a versao de input"
else:
self.msg['text']='Deseja exprimentar a versao input?'
root = Tk()
Application(root)
root.mainloop()
Can someone explain to me how to do when to click the 'Welcome to output version' message'?
Well, you’re creating the
Label
in the constructor with that phrase (that is, with "input" in it), so it is natural that it appears already. You can put another text (empty""
, maybe) in the start label, for example.– Luiz Vieira
I wish that when I click on the not that the phrase changes to welcome the output version and n I’m getting only appears when I load the second time
– GhostCode