button graphics not there

I've had various versions of matplotlib from CVS installed

    > on an Opteron (Red Hat LInux) here for a few weeks now. I
    > had to modify setupext.py to look for various libraries in
    > ../lib64 instead of /lib but matplotlib works very nicely
    > most of the time, and I have started using it for real
    > work.

    > One cosmetic problem: the buttons at the bottom of the
    > plot window have their graphics messed up. They just look
    > like red crosses. The floating xml works, so I know what
    > the buttons do, and it doesn't inconvenience me --- but it
    > looks bad.

    > Presumably some library is either out of date, incomplete,
    > or not linked correctly. I am using the default TkAgg
    > backend. Any thoughts on what I should look for would be
    > appreciated.

We used to see something like this on OSX with the WX backend. What
version of Tk are you using? Could this be a byte order or byte size
problem?

The code that loads the buttons is in
matplotlib.backends.backend_tkagg

    def _Button(self, text, file, command):
        file = os.path.join(rcParams['datapath'], file)
        im = Tk.PhotoImage(master=self, file=file)
        b = Tk.Button(
            master=self, text=text, padx=2, pady=2, image=im, command=command)
        b._ntimage = im
        b.pack(side=Tk.LEFT)
        return b

you may want to read up on the tk PhotoImage and Button classes and
see if there is some option that makes this work. I don't have access
to the opteron platform to test on. The tk backend uses the ppm files
for the icons (eg home.ppm). Do any of the other icon image formats
that ship with matplotlib (xpm, png, svg) work for you? You can test
this by editing the _init_toolbar code in backend_tkagg.py

        self.bHome = self._Button( text="Home", file="home.ppm",
                                   command=self.home)

and trying different extensions.

Thanks,
JDH

John,

Sorry to have bothered you about this -- the solution should have been obvious to me. The problem was simply that I had specified MATPLOTLIBDATA to something different to the matplotlib data directory where the button images actually were. This data directory seems to be in the default location, so unsetting MATPLOTLIBDATA solved the problem.

The problem had arisen because I had installed matplotlib to a nonstandard directory with
python setup.py install --home=$PREFIX
From the documentation [http://matplotlib.sourceforge.net/installing.html] I had got the impression that MATPLOTLIBDATA also needed to be set= to the directory on which I wanted to install matplotlib ... of course this is *not* the data directory.

Thanks for your help, & for a really professional piece of software.

George.

···

On 22 Feb 2006, at 14:30, John Hunter wrote:

    > I've had various versions of matplotlib from CVS installed
    > on an Opteron (Red Hat LInux) here for a few weeks now. I
    > had to modify setupext.py to look for various libraries in
    > ../lib64 instead of /lib but matplotlib works very nicely
    > most of the time, and I have started using it for real
    > work.

    > One cosmetic problem: the buttons at the bottom of the
    > plot window have their graphics messed up. They just look
    > like red crosses. The floating xml works, so I know what
    > the buttons do, and it doesn't inconvenience me --- but it
    > looks bad.

    > Presumably some library is either out of date, incomplete,
    > or not linked correctly. I am using the default TkAgg
    > backend. Any thoughts on what I should look for would be
    > appreciated.

We used to see something like this on OSX with the WX backend. What
version of Tk are you using? Could this be a byte order or byte size
problem?

[snipped]
Thanks,
JDH