我试着用一个png文件和Tkinter来制作一个透明的按钮,但是我做不到,我还试着用画布或标签来做。我需要一种加载png图像的方法,比如箭头,当我按下它的时候做一些事情。 这是我的代码:
from Tkinter import *
import cv2
import Image, ImageTk
class AppButton(Label):
def __init__(self,father,imagename):
Label.__init__(self,father,width=buttonwidth,height=buttonheight,bd=0)
orig = Image.open(imagename)
resized = orig.resize((buttonwidth,buttonheight),Image.ANTIALIAS)
self.imagetkicon = ImageTk.PhotoImage(resized)
self.config(image=self.imagetkicon)
self.bind('<Button-1>',callbackmethod)
谢谢!在
目前没有回答
相关问题 更多 >
编程相关推荐