On Monday 04 June 2007 07:53, Paul McNett wrote:
> johnf wrote:
> > I have sub-classed dTextBox to provide a way to validate numbers. In
> > this case I'm trying to provide a visual clue to the user that number is
> > invalid by setting the background color of the textbox to pink.
> >
> > With (self.IntegerWidth = 2 and self.DecimalWidth =2
> >
> > self.BackColor executes if I type ".999" in the following code. But I
> > only get a color change sometimes.
> >
> > pattern='^([0-9]{0,%s})(\.[0-9]{0,%s})?$' % (self.IntegerWidth,
> > self.DecimalWidth)
> > if re.match(pattern, self.GetValue())is None:
> > self.BackColor == "pink"
> > else:
> > self.BackColor == "white"
> >
> >
> > Is there some interaction between my class and dTextBox? Or BackColor
> > has some bug?
>
> John, I gotta run, so don't take these quick points personally, but
> constructively:
>
OK
> 1) This should be posted on dabo-users, not dabo-dev.
Why? I think there is something wrong at the framework level or lower wxPython.
>
> 2) Liberal print statements help (is the codeblock even running?)
>
Yes! It is running.
> 3) No space between ) and 'is None:' should cause syntax error.
>
Miss typed!
> 4) Unit test your regex to make sure it is working how you expect.
>
It works.
> 5) Instead of "white", set the normal background to something like
> 'blue' so you know if the code block is working or not. I'm not getting a
> color change from self.BackColor = 'blue' although the line of code does
> excute (from the debugger).
There is nothing wrong with the re statement. The line self.BackColor ==
"pink" does excute just nothing occurs or a better statement is that the color
change does not appear.
I'm little confused about how I should explain what is happening. In the past
you have asked me to provide code to help explain the problem. The code is not
meant for you to run but a means to explain what I'm doing. It takes time to
provide a running example. For example if I had said BackColor is not working
for me. You would have said it works for me without some sort of context and I
would have agreed. I guess I will have to provide a test case.
--
John Fabiani
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]