Strange interference(?) between multiline TextCtrl and ColourDialog

Hi everybody,

I have come across a very strange problem. I have a dialog that contains both a wx.TextCtrl (to enter text for a label, to be added somewhere else in my application) as well as several buttons that, when clicked, open a wx.ColourDialog to allow the user to select colors for the text, background, and the label border (see screen shots below).

Now here is the problem: It seems like the “wx.TE_MULTILINE” style flag is causing the ColourDialog trouble in returning the selected color. More specifically, it always returns black! When I comment out the multiline option, everything works as intended (see second screen shot).

I would very much like to be able to have a multi-line text entry field. What is this? Can anybody help?

Thanks,

Ingrid

PS: Python 2.7.2 on Mac OS X 10.8.5; wxPython 2.9.4.0

PPS: Sample code is attached. (Sorry it is rather long. The relevant part is in “class CustomDialog” > “def initLabelTextField”.)

color_problem.py (14 KB)

Ingrid wrote:

Now here is the problem: It seems like the "wx.TE_MULTILINE" style
flag is causing the ColourDialog trouble in returning the selected
color. More specifically, it always returns black! When I comment
out the multiline option, everything works as intended (see second
screen shot).

For what it's worth, it works fine with wx 2.8.12.1 on Windows 7.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Also works on my
Windows 7
Python version=2.7.5 final 0
wxPython version=2.9.5.0 msw (classic)

···

On 10/16/2013 8:26 PM, Tim Roberts wrote:

Ingrid wrote:

Now here is the problem: It seems like the "wx.TE_MULTILINE" style
flag is causing the ColourDialog trouble in returning the selected
color. More specifically, it always returns black! When I comment
out the multiline option, everything works as intended (see second
screen shot).

For what it's worth, it works fine with wx 2.8.12.1 on Windows 7.

Ingrid wrote:

Hi everybody,

I have come across a very strange problem. I have a dialog that contains
both a wx.TextCtrl (to enter text for a label, to be added somewhere
else in my application) as well as several buttons that, when clicked,
open a wx.ColourDialog to allow the user to select colors for the text,
background, and the label border (see screen shots below).

Now here is the problem: It seems like the "wx.TE_MULTILINE" style flag
is causing the ColourDialog trouble in returning the selected color.
More specifically, it always returns black! When I comment out the
multiline option, everything works as intended (see second screen shot).

I would very much like to be able to have a multi-line text entry field.
What is this? Can anybody help?

It seems to be working fine for me on 2.9.5.0:

$ python color_problem.py
2.9.5.0 osx-cocoa (classic)
color from Python: (0, 255, 255, 255)
color for Matplotlib: (0.0, 1.0, 1.0, 1.0)
color from Python: (128, 0, 0, 255)
color for Matplotlib: (0.501960784314, 0.0, 0.0, 1.0)
color from Python: (255, 128, 0, 255)
color for Matplotlib: (1.0, 0.501960784314, 0.0, 1.0)

···

--
Robin Dunn
Software Craftsman

Works fine on Windows XP Pro SP3

multiline flag and the color pickers work with these versions…
wx2.8.12.1, wx2.9.4.0, wx2.9.5.0

The specific Mac version might have something todo with it.
I have known some people to have strange little stuff like this happen when testing on a newer version, which usually leads to tweaking the code.
Have you tested on any other version?

I don’t own a mac but occasionally test my program on “Snow leopard” IIRC. The color issue does sound a bit strange… Was this a one time issue or can you reproduce it?

Mac version infos from wikipedia