如何解决如何使用图像作为按钮功能Tkinter
原始代码:
search_button = Button(Frame3,text="Search",command=lambda: displaySelected(),bg="black",fg="white",font=('Arial',10),padx=5,pady=5)
search_button.place(x=210,y=190)
原始输出如何: Click to view for better visualisation (focus on the blue circle,ignore the other features there)
displaySelected()的作用是: Basically show data based on the Country and Institution user selects
我尝试过的事情:
search_pic = PhotoImage(file="search.png")
search_button = Button(Frame3,image=search_pic,y=190)
基本上,我想执行相同的功能,只是我不想使用按钮“搜索”,而是希望将其替换为png文件,以获取更好的外观。但是,当我运行代码时,由于某种原因我的png没有显示出来?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。