wxButton SetBitmap not affect on another linux box Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
cwall
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu May 18, 2017 6:36 am

wxButton SetBitmap not affect on another linux box

Post by cwall »

Hi, all
I use wxButton.SetBitmap (wxBitmap(a_char_poinrt_to_xpm), wxTOP) to set the bitmap for a wxButton, it can be showing on Debian 8.04. But on another linux box (Raspbian on an rpi), it can't show bitmap. Label showing is correct.
On both platform, I install libwxgtk3.0-dev package to compile the application.
I don't known the relation between wxWidgets and GTK+. It seems there is no wxWidgets packet alone on debian.
Raspbian was based on debian, BTW.
Thanks.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxButton SetBitmap not affect on another linux box

Post by DavidHart »

Hi,
I don't known the relation between wxWidgets and GTK+
On Linux, by default wxWidgets uses gtk+ as its native API. That's why the packages tend to be called libwxgtk*.deb or wxGTK*.rpm.
But on another linux box (Raspbian on an rpi), it can't show bitmap.
Perhaps xpm is a type of bitmap that your raspbian install can't handle. Try switching to a different type e.g. png instead of xpm.

If that's unhelpful, have a look at the wx samples. On debian that means installing the wx3.0-examples package. It installs to /usr/share/doc/wx-examples/. There's also a script there to decompress and build them.

Several of the samples use 'sample.xpm'. Does it work in one of them e.g. 'minimal'?

Regards,

David
cwall
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu May 18, 2017 6:36 am

Re: wxButton SetBitmap not affect on another linux box

Post by cwall »

I compile the example minimal, and the icon can't show, too.
I installed the package graphicsmagick-imagemagick-compat, it can translate a png to xpm by command convert. but the minimal icon not show....

maybe I should install a fresh debian environment to test it later.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxButton SetBitmap not affect on another linux box

Post by DavidHart »

One thing to do is to see if your wxWidgets was compiled with xpm support. To do that, look inside /usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0/wx/setup.h (for a 64bit wx).
Mine contains:
#define wxUSE_XPM 1
cwall
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu May 18, 2017 6:36 am

Re: wxButton SetBitmap not affect on another linux box

Post by cwall »

I find two setup.h on both linux boxes. the contents are same:

/usr/lib/.../wx/include/base-unicode-3.0/wx/setup.h
#define wxUSE_XPM 0

/usr/lib/.../wx/include/gtk2-unicode-3.0/wx directory.
#define wxUSE_XPM 1

In my Makefile:
CXX = `wx-config --cxx`
LIBS=`wx-config --libs`
CXXFLAGS=`wx-config --cflags`

So I run wx-config --cflags --libs on two boxes, and they are same too.
box1:
-I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
-I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0: No such file or directory
pi@raspberrypi:~ $ -L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0

box2:
-I/usr/lib/arm-linux-gnueabihf/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
-L/usr/lib/arm-linux-gnueabihf -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxButton SetBitmap not affect on another linux box

Post by DavidHart »

So that isn't the cause. (wxBase is only used for non-gui programs, so its setup.h is supposed to have wxUSE_XPM 0.)

I presume you don't have any helpful error messages if you run the sample from a terminal. It might be worth trying installing the libwx debug packages and see if any messages appear.

If none do, then the next step would be to do a proper debug with gdb, ideally with a self-built wxGTK. However I would understand if you feel that would be too time-consuming in an rpi.
cwall
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu May 18, 2017 6:36 am

Re: wxButton SetBitmap not affect on another linux box

Post by cwall »

I installed a fresh Debian Jessie (not rpi), and there is no bitmap displayed, too.
I installed libwxgtk3.0-0-dbg too. only this message displayed when I run the prog.
It seems there is only debug way to find the problem.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxButton SetBitmap not affect on another linux box

Post by DavidHart »

I installed a fresh Debian Jessie (not rpi), and there is no bitmap displayed, too.
But you originally said:
I use wxButton.SetBitmap (wxBitmap(a_char_poinrt_to_xpm), wxTOP) to set the bitmap for a wxButton, it can be showing on Debian 8.04.
What is the difference between those two jessie installs?
Does the 'minimal' sample have an icon on both, or only on one?
I installed libwxgtk3.0-0-dbg too. only this message displayed when I run the prog.
What message was that?
cwall
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu May 18, 2017 6:36 am

Re: wxButton SetBitmap not affect on another linux box

Post by cwall »

The two Debian Jessie are different of couse, but I don't known the detail of that. the First one I used for a long time, so maybe there are some packages installed already.

So the second fresh Debian Jessie was created and I'm using it to see if it is the problem occured on rpi only. And it's not the problem of rpi/raspbian obviously.

the program only show one msg:
Gtk-Message: Failed to load module "canberra-gtk-module"
It seems have no relation to bitmap.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxButton SetBitmap not affect on another linux box

Post by DavidHart »

The two Debian Jessie are different of couse, but I don't known the detail of that. the First one I used for a long time, so maybe there are some packages installed already.
I see. You can easily save a list of the installed packages in an installation; see https://wiki.debian.org/ListInstalledPackages. Comparing the lists of the 2 installs should find the answer, along with a lot of irrelevant results.
cwall
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu May 18, 2017 6:36 am

Re: wxButton SetBitmap not affect on another linux box

Post by cwall »

I just install another Jessie. This time I install KDE desktop, and find the Bitmap shows.

Before this, I install a lxde.

It seems that xpm bitmap function rely on KDE or alike advanced desktop environment.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxButton SetBitmap not affect on another linux box

Post by DavidHart »

It's more likely that the missing library just happens to be one of kde's many dependencies.

FWIW I just checked a lubuntu zesty virtualbox guest. That has no problem displaying xpms, so it's not directly a lxde issue.
Post Reply