[pygtk] image on a Button
sandbox_mail
sandbox_mail at yahoo.de
Wed Sep 30 06:27:15 WST 2009
I did not try it out but my first guess is: the image is not found in
Windows due to the different path syntax.
In linux you will have a path like /home/user/picture.jpg but in windows
1.) there is no /, instead \ is used
2.) absolute paths start at the drive letter like C:\Users\picure.jpg
I believe python's "os" module will help you build the correct paths
depending on which system the code is running.
Gorse Emmanuel wrote:
> Hye,
>
> I'm using this code to display an image on a button:
>
> img = gtk.Image()
> img.set_from_file(imgFullFile)
> button.set_image(img)
>
> with imgFullFile beeing the absolute path of the image.
>
> The code works fine under Linux, but the image is not displayed under Windows.
> Do you have any idea why ?
>
> Regards,
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
More information about the pygtk
mailing list