对于按钮,我想将“文本”更改为“图像” 例如橡皮擦的图片,而不是带有文字的橡皮擦。
这是代码部分:
def __init__(self):
self.root = Tk()
self.choose_size_button = Scale(self.root, from_=1, to=15, orient=HORIZONTAL)
self.choose_size_button.grid(row=0, column=1)
self.draw_button = Button(self.root, text='Draw', command=self.use_draw)
self.draw_button.grid(row=0, column=2)
self.color_button = Button(self.root, text='Colour', command=self.choose_color)
self.color_button.grid(row=0, column=3)
self.eraser_button = Button(self.root, text='Eraser', command=self.use_eraser)
self.eraser_button.grid(row=0, column=4)
self.c = Canvas(self.root, bg='white', width=650, height=600)
self.c.grid(row=1, columnspan=5)
self.setup()
self.root.mainloop()