0
我有一張圖片可以顯示,而且我想調整其大小(實際上是放大)。這是我的代碼,使用其他SO問題,但我沒有得到任何結果 - 我的圖像仍然具有相同的大小。調整按鈕大小也不會更改圖像大小。僅使用Tkinter調整pgm圖像的尺寸
我試過這個問題的答案:Image resize under PhotoImage但他們不會工作。
from Tkinter import *
root = Tk()
root.withdraw()
def cleanUp():
root.destroy()
def openWebsite():
print 'Will try to implement opening the website here.'
window = Toplevel(root)
window.protocol('WM_DELETE_WINDOW', cleanUp)
photo = PhotoImage(file="Header.pgm")
photo.zoom(2)
button = Button(window, image=photo, command=openWebsite)
button.pack()
root.mainloop()