python中利用tkinter如何展现好看的图片,

from tkinter import  *

win = Tk()
win.geometry("400x400")
win.title("练习输入框")


b = PhotoImage(file=r"D:\AIshaoNv\桌面\新123\1_VR4DO%}Y%2Y(~LS{677`K.gif")

def aa():
    aaa = Label(text="""这是一只会打篮球的小鸡
                            真的啊
                                不信你自己看
                                    →""")
    aaa.pack()
    image = Label(win, image=b)
    image.pack()


a = Button(win,text="按钮",command=aa,fg="red")
a.pack()



win.mainloop()

运行结果展示

代码运行后如图所示出现实例化界面,点击按钮后调用设置函数

运行成功

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_45687410/article/details/108835474