1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Rep Power

    EPS and imagemagick difficulty

    I posted on this a while back. I am having trouble getting PythonMagick to work. As soon as I include it in a source file and try to compile here is the error I get
    Traceback (most recent call last):
    File "dum2.py", line 2, in <module>
    from PythonMagick import *
    File "/var/lib/python-support/python2.6/PythonMagick/__init__.py", line 1, in <module>
    import _PythonMagick
    ImportError: /var/lib/python-support/python2.6/PythonMagick/_PythonMagick.so: undefined symbol: _ZTIN5boost6python15instance_holderE

    I am using ubuntu 9 and python 2.6. I am somewhat new to python. My goal is to display an EPS file or a PDF file in a tkinter window of some sort. Any direction would be greatly appreciated in either how to accomplish this or how to get PythonMagick working.

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2009
    Rep Power
    Tkinter handles gif & ppm images without any add ons, so use one the pdf2(to)xxx tools, or imagemagick to convert to gif or ppm. You could also use the PIL but it only writes pdf. This is an example of PIL from one of the other forums.
    # use a Tkinter label as a panel/frame with a background image
    # note that Tkinter only reads gif and ppm images
    # use the Python Image Library (PIL) for other image formats
    # free from http://www.pythonware.com/products/pil/index.htm
    # give Tkinter a namespace to avoid conflicts with PIL
    # (they both have a class named Image)
    import Tkinter as tk
    from PIL import Image, ImageTk
    root = tk.Tk()
    root.title('background image')
    # pick an image file you have .bmp  .jpg  .gif.  .png
    # load the file and covert it to a Tkinter image object
    imageFile = "Flowers.jpg"
    image1 = ImageTk.PhotoImage(Image.open(imageFile))
    # get the image size
    w = image1.width()
    h = image1.height()
    # position coordinates of root 'upper left corner'
    x = 0
    y = 0
    # make the root window the size of the image
    root.geometry("%dx%d+%d+%d" % (w, h, x, y))
    # root has no image argument, so use a label as a panel
    panel1 = tk.Label(root, image=image1)
    panel1.pack(side='top', fill='both', expand='yes')
    # put a button on the image panel to test it
    button2 = tk.Button(panel1, text='button2')
    # save the panel's image from 'garbage collection'
    panel1.image = image1
    # start the event loop

IMN logo majestic logo threadwatch logo seochat tools logo