[ wxwindows-Bugs-1768649 ] Setting Colours from Strings on GTK
SourceForge.net
noreply at sourceforge.net
Thu Aug 16 10:14:04 PDT 2007
Bugs item #1768649, was opened at 2007-08-06 12:27
Message generated for change (Comment added) made by ftobia
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1768649&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxGTK specific
Group: Platform specific
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Frank Tobia (ftobia)
Assigned to: Nobody/Anonymous (nobody)
Summary: Setting Colours from Strings on GTK
Initial Comment:
The documentation for wx.Colour states:
"""
In wxPython there are typemaps that will automatically convert from a colour name, from a '#RRGGBB' colour hex value string, or from a 3 integer tuple to a wx.Colour object when calling C++ methods that expect a wxColour. This means that the following are all equivallent:
win.SetBackgroundColour(wxColour(0,0,255))
win.SetBackgroundColour('BLUE')
win.SetBackgroundColour('#0000FF')
win.SetBackgroundColour((0,0,255))
"""
On wxGTK, the conversion from a colour name is handled improperly for some (but not all) colours. For example, after a call to win.SetBackgroundColour('NAVY'), win.GetBackgroundColour() will not match wx.NamedColour('NAVY').
I have attached a file with a list of these colour strings. "Actual colour" is the result of wx.NamedColour, and does not vary across platforms. "Colour produced" is the result of calls to win.SetBackgroundColour and then win.GetBackgroundColour.
These results appear to be the same no matter which accessor functions are used (GetForegroundColour, GetBackgroundColour, GetOwnForegroundColour, GetOwnBackgroundColour).
----------------------------------------------------------------------
>Comment By: Frank Tobia (ftobia)
Date: 2007-08-16 13:14
Message:
Logged In: YES
user_id=1830189
Originator: YES
wx.GetDisplayDepth() returns 24 on my platform.
Just curious:
wx.NamedColour('NAVY') returns wx.Colour(0,0,128,255) for me, while
wx.TheColourDatabase.Find('NAVY') returns wx.Colour(35,35,142,255). What
does wx.NamedColour('NAVY') return for you?
----------------------------------------------------------------------
Comment By: Robin Dunn (robind)
Date: 2007-08-13 20:31
Message:
Logged In: YES
user_id=53955
Originator: NO
What color depth is your display using? Color remappings like this could
be explained by the system changing the window colors to fit into a 16-bit
range if you are not using a 24-bit display. I tried a few of the color
names in your list on my system and they all work fine.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1768649&group_id=9863
More information about the wx-dev
mailing list