Skip to content

Instantly share code, notes, and snippets.

@alvesjnr
Created February 26, 2013 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alvesjnr/5038127 to your computer and use it in GitHub Desktop.
Save alvesjnr/5038127 to your computer and use it in GitHub Desktop.
try:
#py 2.x
from Tkinter import *
except ImportError:
#py 3.x
from tkinter import *
app = Tk()
text_var = StringVar()
text_var.set("testando")
frame = Frame(app, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
def trocar_texto():
text_var.set("foi testado")
label = Label(app, textvariable=text_var)
label.pack()
button = Button(app, text='click', command=trocar_texto)
button.pack()
sair = Button(app, text='Sair', command =app.destroy)
sair.pack(side=BOTTOM)
app.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment