我一直在为我的游戏制作主页,我试图将png图像制作成一个按钮。但我无能为力。 这是我的代码;
# Homepage Code
import sys
from Tkinter import *
button_flag = True
def click():
global button_flag
if button_flag:
button1.configure(bg='white')
button_flag = False
else:
button1.configure(bg='green')
button_flag = True
root = Tk()
mPage = Tk()
mPage.geometry('1000x1000')
mPage.title('Homepage')
mPage.configure(bg='#FFB6C1')
l = Label(mPage, text = 'Pick Which Game That You Want To Play?',font=('TW Cen MT',45), fg='white', bg='#FFB6C1')
l.pack()
hardest = Label(mPage, text = "World's Hardest Game",font=('Ariel',25), fg='white', bg='FFB6C1')
hardest.place(x=200, y=200)
hardestphoto = PhotoImage(file='HARD.PNG')
button1 = Button(mPage, width=155, height=55, image=hardestphoto, bg='#FFB6C1')
button1.place(x=200, y=350)
mPage.mainloop()
如何将我的png图像'Hard.PNG'制作成按钮?