I know this isn't exactly what you asked, but I am displaying an image in a 
label in a --onefile distribution, and this code works both while debugging and 
while running the packaged application:
      
               if getattr(sys, 'frozen', None):
             basedir = sys._MEIPASS
        else:
             basedir = os.path.dirname(__file__)  
        self.photo = tk.PhotoImage(file=os.path.join(basedir, 'myImage.gif'))
        self.myLabel = ttk.Label(self.myFrame, image=self.photo)
        self.myLabel.grid()

Lynn

On Oct 4, 2012, at 10:29 AM, Michael O'Donnell <michael.odonn...@uam.es> wrote:

> Hi Matthew,
> 
> Your first line should in fact be:
> 
> from PIL import Image
> 
> ...then your line:
> 
> my_image = Image.open("imagepath.jpg")
> 
> Mick
> 
> On Thu, Oct 4, 2012 at 7:16 PM, Matthew Ngaha <chigga...@gmail.com> wrote:
>> 
>> im trying to display an image. Ive tried different code from several
>> tutorials but they seem outdated and nothing works. here's 1 line that
>> makes me give up.
>> 
>> 
>> 
>> this line returns an error of Image doesnt have attribute open, yet
>> this is what my tutorial has shown me. can anyone please help?
>> 
>> any new tkinter tutorials around?
>> _______________________________________________
>> Tkinter-discuss mailing list
>> Tkinter-discuss@python.org
>> http://mail.python.org/mailman/listinfo/tkinter-discuss
> 
> 
> 
> -- 
> 
> Not sent from my iPhone
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss@python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to