473,732 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem compiling Tkinter program with bmp images using py2

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 .bmp files in the same folder as the script.
I run my .py script (from IDLE) and all the backgrounds are loaded as intended.

in my script I load the images like this:

root = Tk()
im = PIL.Image.open( 'backg2.bmp')
photo1 = PIL.ImageTk.Pho toImage(im)

iminfo = PIL.Image.open( 'backg3.bmp')
photo2 = PIL.ImageTk.Pho toImage(iminfo)

imlabel = PIL.Image.open( 'backg4.bmp')
photo4 = PIL.ImageTk.Pho toImage(imlabel )
....

and put them on the widgets like this:

Label(win, text=message, background=rgb( 150,150,120), image=photo2).p ack()
....

Now, I want the same program to run as exe file on another computer, so I compiled it with py2exe.
I copied the bmp's to the same folder as my executable.
When I try to run the compiled exe i get:

Traceback (most recent call last):
File "make_ma2.p y", line 461, in ?
File "PIL\Image.pyo" , line 1745, in open
IOError: cannot identify image file

Are there specific things to take care of when compiling a tkinter program with bitmap backgrounds?

thanks,
tim

Jan 26 '06 #1
0 1750

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

Similar topics

6
683
by: Club-B42 | last post by:
i've compiled my programm using command "python setup.py py2exe >1" python script works fine, but .exe version fails with ===================================================================== D:\\Scripts\B-4-2\la2luncher\dist>la2launcher.exe Traceback (most recent call last): File "la2launcher.py", line 9, in ? File "config.pyc", line 11, in ? File "config.pyc", line 8, in u LookupError: no codec search functions registered: can't find...
2
991
by: Martin Jensen | last post by:
Hi I have a problem with Qt. My class definition is this: class Button : public QObject, public Tk_Object { Q_OBJECT public: Button() {} Button(Tk_Object &p); ~Button();
2
3735
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. canvas=Canvas(master,blah...) canvas.pack() def change_pic(path): global pic image=Image() #I'm using PIL to use the images, but I
8
2555
by: vbgunz | last post by:
Hello world, I tried looking everywhere for a decent Tkinter GUI builder and the closest I got to finding one before being horrified from looking at the source was vtcl @ http://vtcl.sourceforge.net. The next closest thing was page @ http://page.sourceforge.net/ Page just didn't cut it for me and I got several errors from it whereas vtcl was almost a dream come true. it was not only perfect but I had a full fledged gui design up and...
2
9476
by: sj | last post by:
I am just learning to use Tkinter and am having problems displaying image files. I am able to display an image using tutorials (such as http://www.daniweb.com/code/snippet296.html) But when I try my own code all I get is an empty widget. What is wrong with the following program? from Tkinter import *
3
2357
by: aldonnelley | last post by:
Hi all. Just having a weird problem with tkinter. I'm trying to make a gui that shows results from an image search, with a "forward" and "back" button so the user can compare results from different pages. All that's working fine... The problem I'm having is that the images don't show onscreen the first time the "first page" of results shows up. When I click the "search again" button, and have more than the original results page to...
44
4996
by: bg_ie | last post by:
Hi, I'm in the process of writing some code and noticed a strange problem while doing so. I'm working with PythonWin 210 built for Python 2.5. I noticed the problem for the last py file processed by this script, where the concerned tmp file is only actually written to when PythonWin is closed. In other words, after I run this script, one of the generated tmp files has a size of 0kB. I then close PythonWin and it is then written to.
5
3443
by: msunderwd | last post by:
Having a problem with "compiling" a Tkinter/python program using py2exe (and pyinstaller, for that matter)... I have several dialogs that are derived from the tkSimpleDialog.Dialog class. These work just fine if run through the interpreter. When I "compile" this with py2exe, I don't see any errors, and when I execute the resulting program, it "appears" to work fine until I invoke one of the derived dialogs. Then, I get the "body" of...
2
10129
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 = 'C:/users/saftarn/desktop/images/blob4.jpg') #im = file = 'C:/users/me/desktop/images/blob4.jpg'
0
8774
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9235
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9181
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.