Lesson 12

This is python lesson 12

In this lesson we will be adding icons, colour and images to our GUIs to make them stand out. First lets add an image.


photo = tkinter.PhotoImage(file=”put your own file here”)

w = tkinter.Label, image=photo)



The above piece of code creates an image. If you want the image at the top put the image code before anything else, for the bottom put it last. Now we can add a colour background.




The piece of code above simply adds colour to the background but the buttons or labels. Let’s add colour colour to them as well.


btn = tkinter.Button(window, text=”Click Me”, background=”blue’)


lbl  = tkinter.Label(window, text=”Click Me”, background=”red’)



This piece of code adds colour to the buttons and labels. Now lets add our own custom icon.


window.iconbitmap(“insert your own file”)


Now we know how to make out GUIs interactive and colourful. What can you create.