big difference in appearance between Windows and Linux

Hi Paul,

Hi all,

After developing my app on Windows XP for a while I recently started
running my app on Linux again (Ubuntu 7.10 to be exact using the
wxPython 2.8 that comes with it).

I noticed a big difference in appearance on the two platforms. For
instance, the font in tabs and buttons is much larger and also the
colors I am setting in a number of places are not visible.

If you are using standard widgets (i.e., not owner-drawn), fonts and
colours are provided by the underlying platform and/or theme. As for
the colours, as far as I know GTK (or some themes in GTK) doesn't
allow to change background/foreground colour for some of the widgets.
I don't know which one they are, but I remember seeing some posts
about the non-effectiveness of SetBackgroundColour() on some widgets
on GTK.

I am probably not the first one to run into this. Are there
best-practices to avoid this? Is there a list of known pitfalls?

There is something here:

http://wiki.wxpython.org/wxPython_Platform_Inconsistencies

But it's far from complete.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Dec 10, 2007 12:58 PM, Paul Sijben wrote:

OK,

I have narrowed down the issues. The biggie is indeed
SetBackgroundColour on a panel. Even a Refresh() on it will not show
the color. However a color set in XRC DOES appear!?

So can anyone tell me the difference between creating a panel in code
and one in XRC?

Paul Sijben wrote:

···

http://wiki.wxpython.org/wxPython_Platform_Inconsistencieshttp://xoomer.alice.it/infinity77/wxPython-users-unsubscribe@lists.wxwidgets.orgwxPython-users-help@lists.wxwidgets.org

-- Paul Sijben tel: +31334566488
Eemvalley Technology BV fax: +31334557523
the Netherlands -----------------------------------------------------
EemValley Technology zoek python & wxpython programmeurs:

http://eemvalley.comhttp://www.eemvalley.nl/jobs

-- Paul Sijben tel: +31334566488
Eemvalley Technology BV fax: +31334557523
the Netherlands -----------------------------------------------------
EemValley Technology zoek python & wxpython programmeurs:

http://eemvalley.comhttp://www.eemvalley.nl/jobs

Andrea Gavana wrote:

wxPython Platform Inconsistencies - wxPyWiki
But it's far from complete.

Quite true -- but it's a Wiki -- please add new items when you discover them!

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Hmm... That's real interesting. There isn't any difference between the two ways of setting the color that I can see. If the bg tag is present then XRC just calls SetBackgroundColour right after the UI widget is created. There doesn't appear to be anything special going on.

In either case, it is probably your GTK theme that is blocking the color changes. For panel backgrounds this is very likely to happen if the theme uses a pixmap for the background, for example for a brushed metal look. You can try fiddling with SetBackgroundStyle to see if that will tell the theme to let the changes go through, or you can change your theme. I've had very good luck with the QtCurve theme. Not only does it allow most (or all?) color changes, but it is also highly configurable for different looks, and has a KDE theme too so both kinds of apps can look nearly the same.

thanks for the tips and I will try them tomorrow.

However I would not like to tell people using my app to change their theme away from the detault in ubuntu....

Paul

Paul Sijben wrote:

Hmm... That's real interesting. There isn't any difference between the two ways of setting the color that I can see. If the bg tag is present then XRC just calls SetBackgroundColour right after the UI widget is created. There doesn't appear to be anything special going on.

In either case, it is probably your GTK theme that is blocking the color changes. For panel backgrounds this is very likely to happen if the theme uses a pixmap for the background, for example for a brushed metal look. You can try fiddling with SetBackgroundStyle to see if that will tell the theme to let the changes go through, or you can change your theme. I've had very good luck with the QtCurve theme. Not only does it allow most (or all?) color changes, but it is also highly configurable for different looks, and has a KDE theme too so both kinds of apps can look nearly the same.

thanks for the tips and I will try them tomorrow.

However I would not like to tell people using my app to change their theme away from the detault in ubuntu....

What are the color changes being used for? Perhaps there is something else that can be done to accomplish the same thing. For example, if you're using a color to indicate an error in a TextCtrl then making a error indicator in a StaticBitmap next to the TextCtrl could be used instead.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Paul Sijben wrote:

Now that the most visible trans-platform issue is solved. It looks like
need to reduce the font size on Linux from the default GTK theme.

Why? The default size comes from the system config and is presumably what the user wants to be used for the default font in all apps. If you want to do it because of layout troubles then you should be using sizers to adapt your layout on the fly to the default size of the font and widgets, and not the other way around.

So let's solve the generic issue: Is there a way to set the font for an
entire application or just a frame?

If you really need to do this then most widgets will inherit the default font from their parent when they are created. So if you set the font on the parent *before the children are created* then it should work for most things.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Paul Sijben wrote:

Now that the most visible trans-platform issue is solved. It looks like
need to reduce the font size on Linux from the default GTK theme.

Why? The default size comes from the system config and is presumably
what the user wants to be used for the default font in all apps. If
you want to do it because of layout troubles then you should be using
sizers to adapt your layout on the fly to the default size of the font
and widgets, and not the other way around.

I notice that the text especially in notebook tabs is very large, so
large that the number of tabs visible is very small

So let's solve the generic issue: Is there a way to set the font for an
entire application or just a frame?

If you really need to do this then most widgets will inherit the
default font from their parent when they are created. So if you set
the font on the parent *before the children are created* then it
should work for most things.

thanks I will try that!

Paul

···

--
Paul Sijben tel: +31334566488
Eemvalley Technology fax: +31334557523
the Netherlands http://eemvalley.com
-----------------------------------------------------------------
EemValley Technology is hiring Python and wxPython coders! see:
               http://www.eemvalley.nl/jobs

Robin Dunn wrote:

Ah, did you set the panel's color after creating the child widgets?

nope before

···

  XRC would have done it before, and then when the children are
created they would have set their own bg colour to their parent's.

--
Paul Sijben tel: +31334566488
Eemvalley Technology fax: +31334557523
the Netherlands http://eemvalley.com
-----------------------------------------------------------------
EemValley Technology is hiring Python and wxPython coders! see:
               http://www.eemvalley.nl/jobs