0

I have been making a homepage for my games and I was trying to make a png image into a button. But I was incapable of doing so. This is my code;

# 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()

How would I be able to make my png image which is 'Hard.PNG' into a button?

0 Answers0