Skip to content

Instantly share code, notes, and snippets.

@PandyYang
Created February 21, 2018 06:22
Show Gist options
  • Save PandyYang/9b0b50557416f793b4e2cd3cd8bcd32c to your computer and use it in GitHub Desktop.
Save PandyYang/9b0b50557416f793b4e2cd3cd8bcd32c to your computer and use it in GitHub Desktop.
from tkinter import *
def callback():
var.set("是我")
root = Tk()
frame1 = Frame(root)
frame2 = Frame(root)
var = StringVar()
var.set("点击查看")
# textLable = Label(root,text = "前方发现美女!")
# textLable.pack()
#
# photo = PhotoImage(file = "123.gif")
# imgLabel = Label(root,image=photo)
# imgLabel.pack()
textLabel = Label(frame1,
textvariable = var,
justify = LEFT,
padx=10
)
textLabel.pack(side = LEFT)
photo = PhotoImage(file = '123.gif')
imgLabel = Label(frame1,image = photo)
imgLabel.pack(side = RIGHT)
theButton = Button(frame2,text = "这是谁?",command=callback)
theButton.pack()
frame1.pack()
frame2.pack()
mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment