473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Images in Tkinter

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!

Jul 20 '07 #1
1 2285
On Jul 20, 11:37 am, "Viewer T." <dtgead...@yahoo.comwrote:
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-tk...not-appear.htm

Mike

Jul 20 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Elaine Jackson | last post by:
Hi! I'm working on a script that displays images on Tkinter buttons, and I'd like to be able to do the following things: 1) Ensure that a button, whose 'image' attribute changes during execution...
2
by: Tim Flynn | last post by:
Hi, I'm trying to write a simple image viewer using Tkinter and ImageTk from the PIL toolkit. The images are stored in memory and I don't want to create temporary files for them. My code...
2
by: Tuvas | last post by:
I've been trying to use a canvas to display different pictures on a Tkinter interface. However, it doesn't seem to update the information. Ei, I have something like this. ...
0
by: erkidevries | last post by:
Problem compiling Tkinter program with bmp images (using py2exe) I have a Tkinter gui program that uses bmp as backgrounds. The program itself works when I run from the source. I placed the...
9
by: peter.mosley | last post by:
Hello again I'm still wrestling with Python / Tkinter / PIL. I have almost got it to work - on a Fedora Core 1 system I can now display images in a Tkinter window. But I also run a Fedora Core...
2
by: arvind | last post by:
hi all, how to get out of the python shell which is executing a command? how to use images in the background of a page in Tkinter?
4
by: larry | last post by:
Ok I'm a Python noob, been doing OK so far, working on a data conversion program and want to create some character image files from an 8-bit ROM file. Creating the image I've got down, I open...
2
by: defn noob | last post by:
from Tkinter import * import os master = Tk() w = Canvas(master, width=800, height=600) print os.path.exists('C:/me/saftarn/desktop/images/blob4.jpg') im = PhotoImage(file =...
2
by: Pedro | last post by:
Hi I'm trying to build a small application that can display some images in a toplevel window. I have this code: def Results(master): from Tkinter import Toplevel, Button, Label from PIL...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.