wxPy2.5, colours, database and demo

I find all this colour stuff a little bit confusing.
(I know what is going on, but for a newbie...)

The colours database is initialized in the wx.App initalization.
That's ok.

In an object, you can set a colour with the following
statement:
     object.SetBackgroundColour('RED').
This is handy, but 'RED' is not wxColour.

    print object.SetBackgroundColour.__doc__ returns
    SetBackgroundColour(wxColour colour) -> bool

[note the wxColour and not wx.Colour]

One can accept this king of exception, but in that
case a constructor like
    k = wx.Colour('RED')
    object.SetBackgroundColour(k)
should work and not fail.
Hovever, this constructor works
    k = wx.NamedColour('RED')
    object.SetBackgroundColour(k)

k = wx.Colour('#ff00ff') also fails.
and
k = wx.NamedColour('#ff00ff')
understand the #ff0000 as a wrong name. That's ok.

One another aspect of confusion lies in the demo.
In wxPython, there are two colours databases.
1) TheColourDatabase wxWindows/wxPython
2) the database from the module colourdb wxPython only?

The demo does not emphasize, it is using the second database.

Jean-Michel Fauth, Switzerland

Jean-Michel Fauth wrote:

I find all this colour stuff a little bit confusing.
(I know what is going on, but for a newbie...)

The colours database is initialized in the wx.App initalization.
That's ok.

In an object, you can set a colour with the following
statement:
     object.SetBackgroundColour('RED').
This is handy, but 'RED' is not wxColour.

    print object.SetBackgroundColour.__doc__ returns
    SetBackgroundColour(wxColour colour) -> bool

[note the wxColour and not wx.Colour]

Yeah, I'm working on that.

One can accept this king of exception, but in that
case a constructor like
    k = wx.Colour('RED')
    object.SetBackgroundColour(k)
should work and not fail.

That could be possible in 2.5 but I would have to disable kwargs for the constructor, but it's never really been an issue in the past and good docs will help even more in the future.

Hovever, this constructor works
    k = wx.NamedColour('RED')
    object.SetBackgroundColour(k)

k = wx.Colour('#ff00ff') also fails.
and
k = wx.NamedColour('#ff00ff')
understand the #ff0000 as a wrong name. That's ok.

One another aspect of confusion lies in the demo.
In wxPython, there are two colours databases.
1) TheColourDatabase wxWindows/wxPython
2) the database from the module colourdb wxPython only?

Not really, the colourdb module is meant to load a set of additional colour names and rgb values into TheColourDatabase. That list of names/values also happens to be available directly as Python lists.

The demo does not emphasize, it is using the second database.

Yeah, the overview string for the demo sample could be more helpful than just "". :wink:

···

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

I'm not going to comment on the rest since I'm sorta right there with you
:slight_smile:

One another aspect of confusion lies in the demo.
In wxPython, there are two colours databases.
1) TheColourDatabase wxWindows/wxPython
2) the database from the module colourdb wxPython only?

The demo does not emphasize, it is using the second database.

Therein is one of the reasons that I am going to focus on clarifying and
updating all the demo modules after 2.5 rolls out (the reason for *after*
is, simply put, it's going to take a LONG time to do it the way I want it
done)

To answer one question: colourdb is indeed wxPython only, and for the *most*
part this is true of any of the python libs in wx.lib (there are exceptions
where an unimplemented feature is fully implemented in Python).

Oh, and actually, if you look at the source code for lib.colourdb.py, you'll
find waaaaay down at the bottom that it IS using wx.TheColourDatabase. This
is just a wrapper that makes it easier to use.

Oh, but let me add, I'll be looking for ways to emphasize and/or illustrate
both the wrapper colourdb and the native control of the colour database in
the future demos.

Yeah, the overview string for the demo sample could be more helpful than
just "". :wink:

You might wanna look again :slight_smile:

(not, in any way, that I think it's 100% correct but as you say, it's better
than """""" :slight_smile: