Opened 11 years ago

Closed 4 years ago

#11659 closed defect (outdated)

ColourDialog doesn't use pre-set data for display

Reported by: ryan52 Owned by: robind
Priority: normal Milestone:
Component: wxPython Version: 3.0.0
Keywords: Cc: ojwbetts+wx@…
Blocked By: Blocking:
Patch: no


This is described here:
and here:

the debian bug report has an updated (for wx 2.8) test case.

Attachments (2) download (3.0 KB) - added by ryan52 11 years ago.
test case download (3.0 KB) - added by ojwb 7 years ago.
testcase updated for wxPython 3

Download all attachments as: .zip

Change History (9)

Changed 11 years ago by ryan52

test case

comment:1 Changed 11 years ago by vadz

  • Resolution set to fixed
  • Status changed from new to closed

Works for me with the following patch to the dialogs sample with the latest svn under wxGTK so this seems to have been fixed in 2.9:

  • samples/dialogs/dialogs.cpp

    a b void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event)) 
    586586    m_clrData.SetColour(m_canvas->GetBackgroundColour());
    588     wxColourDialog dialog(this, &m_clrData);
     588    wxColourDialog dialog(this);
     589    dialog.GetColourData().SetColour(*wxRED);
    589590    dialog.SetTitle(_("Please choose the background colour"));
    590591    if ( dialog.ShowModal() == wxID_OK )
    591592    {

comment:2 Changed 9 years ago by ojwb

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 2.8.10 to 2.8.12

Your test doesn't seem to exercise this bug.

I tested with wx 2.8.12, and I see the bug with Ryan's test script, but patching the dialogs sample as above gives me red preselected. Note that this does seem sensitive to how the colour is preset - see the python script where there's an alternative version which does manage to preset the colour.

I think this is wxPython-specific and the issue probably is that dlg.GetColourData() returns a temporary copy of the colour data, and updating that doesn't actually change the copy the dialog uses. As evidence, note that this:

    log.WriteText('Pre-selected color: %s\n' % str(dlg.GetColourData().GetColour().Get()))


23:56:44: Pre-selected color: (0, 0, 0)

comment:3 Changed 9 years ago by robind

  • Owner set to robind
  • Status changed from reopened to accepted

comment:4 Changed 9 years ago by ojwb

  • Cc ojwbetts+wx@… added

comment:5 Changed 8 years ago by ojwb

  • Version changed from 2.8.12 to 2.9.5

Still present in 2.9.5.

comment:6 Changed 7 years ago by ojwb

  • Version changed from 2.9.5 to 3.0.0

Still present in wxPython

The testcase needs minor changes due to changes in wxPython (new version attached).

Changed 7 years ago by ojwb

testcase updated for wxPython 3

comment:7 Changed 4 years ago by robind

  • Resolution set to outdated
  • Status changed from accepted to closed

Closing old Phoenix tickets...

If this is still an issue in wxPython 4.0.0a1 then please open a new issue (or PR) at the wxPython-Phoenix project page on Github:

Note: See TracTickets for help on using tickets.