Radio button in python

 from tkinter import *


food = ["pizza""hamburger""hotdog"]

window = Tk()
= IntVar()
pizza = PhotoImage(file="2.png")
hamburger = PhotoImage(file="4.png")
hotdog = PhotoImage(file="1.png")
food_img = [pizza, hamburger, hotdog]
# food_img.width(300)
window.geometry("500x500")
for index in range(len(food)):
    radio_btn = Radiobutton(window,
                            font=("Comic",30 ),
                            text=food[index],
                            variable=x,
                            value=index,
                            padx=25,
                            image=food_img[index],
                            compound=LEFT,
                            # width = 200
                            )
    radio_btn.pack(anchor=W)



window.mainloop()

Comments