Hello,

I have added a image file to my code in tkinter but it basically fills my the whole frame so if its possible can you recommend a tutorial that shows or explains how to do this.... unless you can show me on here.

I havent added my full code but the code below should display a test image once you have it saved in the python directory.

I would like to create 'next' button which would open up a new frame with another image on it.

Regards

James

from Tkinter import *

root = Tk()
ButtonImage = PhotoImage(file='test.gif')
testButton = Button(root, image=ButtonImage)
testButton.pack()
root.mainloop()

Recommended Answers

All 2 Replies

Have you considered using the height and width options.

Eg.

example = Tkinter.Button(text = "example", height = 20, width = 60)

Along those lines.
The numbers are how many pixels high and wide.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.