FAQ
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!

Search Discussions

  • Matt McCredie at Jul 20, 2007 at 5:00 pm
    That code doesn't tell me anything. You are going to have to post a more
    complete example to get help. Like, enough code so that I can run it and see
    the same problem.
    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!
    You need to call Tkinter.Tk() before you can create an instance of
    `PhotoImage' (I don't know why, but I know I got a similar error when I
    didn't).

    Matt
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.python.org/pipermail/python-list/attachments/20070720/00ec7641/attachment-0001.html
  • Kyosohma at Jul 20, 2007 at 9:14 pm

    On Jul 20, 11:37 am, "Viewer T." wrote:
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJul 20, '07 at 4:37p
activeJul 20, '07 at 9:14p
posts3
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase