Images in Tkinter

V

Viewer T.

I wrote a class in which I have to use Tkinter images. When I create
an image object in the class and reference it with the image attribute
of label within the class, it does not dhow the image. It just shows a
blank label that conforms to the size of the image. My images is a GIF
image.

My code takes the form:
class Login:
def __init__(self):
create image object and other things necessary for class
initialisation
self.make_widgets
def make_widgets(self):
Then I create my widgets

Then, I instantiate the login class.

I use Python 2.5. Does anyone have any idea why my imae does not
diplay itself? I have tried using the image before outside a class and
it works! Also, I tried creating the image object outside class but it
gives a runtime error saying it is too early to create an image
object. Please help!
 
K

kyosohma

I wrote a class in which I have to use Tkinter images. When I create
an image object in the class and reference it with the image attribute
of label within the class, it does not dhow the image. It just shows a
blank label that conforms to the size of the image. My images is a GIF
image.

My code takes the form:
class Login:
def __init__(self):
create image object and other things necessary for class
initialisation
self.make_widgets
def make_widgets(self):
Then I create my widgets

Then, I instantiate the login class.

I use Python 2.5. Does anyone have any idea why my imae does not
diplay itself? I have tried using the image before outside a class and
it works! Also, I tried creating the image object outside class but it
gives a runtime error saying it is too early to create an image
object. Please help!

This might be the problem: http://effbot.org/pyfaq/why-do-my-tkinter-images-not-appear.htm

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,041
Members
47,643
Latest member
ashutoshjha_1101

Latest Threads

Top