Facing Issue in wxStaticBox widget

Hi All,

Actually i am inheriting wx.StaticBox as given below.

class My_StaticBox(wx.StaticBox):

def __init__(self, Parent = None, id =wx.ID_ANY, text =''  ):

    wx.StaticBox.__init__(self, parent = Parent, id=id )

self.text = text

    self.SetFont(font1)

    self.SetOwnForegroundColour(wx.Colour( 255, 186, 23))

self.SetLabel(self.text)
When you creat a object of StaticBox, So this will set label/string properly with desire color.
But when you press any key( tab or down key) That time the text color
is changing to default (some sort of blue in windows xp)text color, one strange thing is
that, This is happening first time key press only.Once you refresh
this it is working fine ie with desire color of text later on there
is no color change in text color.
I am attaching sample app and screen shot here.

Can you guess where i am doing wrong???

I am using wxpython 2.8.10 on window xp with python 2.5.

Thanks & Reagrds,
Mukul Sharma

staticbox_issue.py (2.39 KB)

scr_first.jpeg

scr_second.JPG

From:
wxpython-users@googlegroups.com [mailto:wxpython-users@googlegroups.com] On
Behalf Of
mukul sharma

···

Sent: Friday, September 17, 2010 8:59 AM
To: wxpython-users@googlegroups.com
Subject: [wxPython-users] Facing Issue in wxStaticBox widget

Hi All,

Actually i am inheriting wx.StaticBox as given below.

class My_StaticBox(wx.StaticBox):

def init(self, Parent = None, id =wx.ID_ANY, text =’’ ):
wx.StaticBox.init(self, parent = Parent, id=id )

self.text = text
self.SetFont(font1)
self.SetOwnForegroundColour(wx.Colour( 255, 186,
23))

self.SetLabel(self.text)
When you creat a object of StaticBox, So this will set label/string properly
with desire color.
But when you press any key( tab or down key) That time the text color
is changing to default (some sort of blue in windows xp)text color, one strange
thing is
that, This is happening first time key press only.Once you refresh
this it is working fine ie with desire color of text later on there
is no color change in text color.
I am attaching sample app and screen shot here.

Can you guess where i am doing wrong???

I am using wxpython 2.8.10 on window xp with python 2.5.

Thanks & Reagrds,
Mukul Sharma


To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

[alm>]

I
don’t see any issues (with and without changing the provided example to match
your email).

I
am on XP using py 2.6 and wx 2.8.11.

Upgrading
may be in order.

I
do have several staticboxes in my own project and change those to black text
without issue.

Al

From:
wxpython-users@googlegroups.com [mailto:wxpython-users@googlegroups.com] On
Behalf Of
Al Mansur

···

Sent: Friday, September 17, 2010 10:22 AM
To: wxpython-users@googlegroups.com
Subject: RE: [wxPython-users] Facing Issue in wxStaticBox widget

From:
wxpython-users@googlegroups.com [mailto:wxpython-users@googlegroups.com] On
Behalf Of
mukul sharma
Sent: Friday, September 17, 2010 8:59 AM
To: wxpython-users@googlegroups.com
Subject: [wxPython-users] Facing Issue in wxStaticBox widget

Hi All,

Actually i am inheriting wx.StaticBox as given below.

class My_StaticBox(wx.StaticBox):

def init(self, Parent = None, id =wx.ID_ANY, text =’’ ):
wx.StaticBox.init(self, parent = Parent, id=id )

self.text = text
self.SetFont(font1)
self.SetOwnForegroundColour(wx.Colour( 255, 186,
23))

self.SetLabel(self.text)
When you creat a object of StaticBox, So this will set label/string properly
with desire color.
But when you press any key( tab or down key) That time the text color
is changing to default (some sort of blue in windows xp)text color, one strange
thing is
that, This is happening first time key press only.Once you refresh
this it is working fine ie with desire color of text later on there
is no color change in text color.
I am attaching sample app and screen shot here.

Can you guess where i am doing wrong???

I am using wxpython 2.8.10 on window xp with python 2.5.

Thanks & Reagrds,
Mukul Sharma


To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

[alm>]

I
don’t see any issues (with and without changing the provided example to match
your email).

I
am on XP using py 2.6 and wx 2.8.11.

Upgrading
may be in order.

I
do have several staticboxes in my own project and change those to black text
without issue.

Al


To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

[alm>]

Looks
like I spoke too soon.

Running
this as a shortcut, rather than from the command line, does show the problem of
the staticBox text changing back to it’s default blue color. The background
color is not changed.

This
happens on any ‘navigation’ key: tab, shift-tab, up/down/left/right arrow,
enter, shift-enter, page up/down and alt (all by itself). There may be others.

It
also happens in my own project but only when run by clicking a shortcut, not
from a cygwin command line.

Is
this a known issue? Is there a workaround?

Al

There’s
an issue with the StaticBox label changing back to its default color (blue)
from whatever it was set to.

This
happens on Windows/XP with wx 2.8.11.

The
problem happens with the Tab key and the Alt key. There may be other such keys
as well. It seems to be related to tab traversal but it only happens one time
per window/panel/dialog and then some sort of ‘reset’ is needed to see it
again.

I
have an app with a dialog that has a 3 tab notebook each page having 2
StaticBoxes. Upon entering the dialog all StaticBoxes are shown in ‘black’
(because of a SetForegroundColour(‘black’) call). Typing Tab or Alt once will
change the StaticBoxes (both of them) to the default ‘blue’. The change occurs
on the key-down; press Alt and the text color changes before the key-up. The
other notebook tabs are not effected, they stay ‘black’ no matter how many
times you hit Tab. One must exit and re-enter the dialog to see the effect
again. The color change caused by the Tab or Alt key press only happens once
per instantiation of the window.

An
easy way to see this is in the wxPython demo’s StaticBox example.

In
the Demo Code tab, right after the line

box
= wx.StaticBox(…

add
this line:

box.SetForegroundColour(
“black” )

then
save it.

Run
the demo and hit Tab or Alt and the label color will, erroneously, be changed
from ‘black’ to ‘blue’. This will only happen once and then you’ll have to visit
the Demo Code tab and then back to the Demo tab to get it to happen again. This
will work once with Tab and once with Alt and then you’ll have to go back to
the Demo Code tab and click Original and then click Modified and then go back
to the Demo tab and it will fail again.

I
have another example with a StaticBox and a Button where the button will change
the box’s label color. With that code I can use the button to change the color
both before and after the Tab key causes the color to change. So the Tab key
effect is not required to be the first key or even early in the process. That
code also has the WIT and it only shows the colors I have set. It never shows
the label color as ‘blue’.

Al

Uh, using different words to ask the same questions or report the same problem is *very* unlikely to generate different results than before. If nobody had any ideas last week then it's doubtful that they will now. The best thing to do at this point is to create a ticket for it at trac.wxwidgets.org so it won't be forgotten and then perhaps when somebody is working on that code again in the future the ticket may spark some ideas.

···

On 9/20/10 1:46 PM, Al Mansur wrote:

There's an issue with the StaticBox label changing back to its default
color (blue) from whatever it was set to.

This happens on Windows/XP with wx 2.8.11.

The problem happens with the Tab key and the Alt key. There may be other
such keys as well. It seems to be related to tab traversal but it only
happens one time per window/panel/dialog and then some sort of 'reset'
is needed to see it again.

I have an app with a dialog that has a 3 tab notebook each page having 2
StaticBoxes. Upon entering the dialog all StaticBoxes are shown in
'black' (because of a SetForegroundColour('black') call). Typing Tab or
Alt once will change the StaticBoxes (both of them) to the default
'blue'. The change occurs on the key-down; press Alt and the text color
changes before the key-up. The other notebook tabs are not effected,
they stay 'black' no matter how many times you hit Tab. One must exit
and re-enter the dialog to see the effect again. The color change caused
by the Tab or Alt key press only happens once per instantiation of the
window.

An easy way to see this is in the wxPython demo's StaticBox example.

In the Demo Code tab, right after the line

box = wx.StaticBox(�

add this line:

box.SetForegroundColour( "black" )

then save it.

Run the demo and hit Tab or Alt and the label color will, erroneously,
be changed from 'black' to 'blue'. This will only happen once and then
you'll have to visit the Demo Code tab and then back to the Demo tab to
get it to happen again. This will work once with Tab and once with Alt
and then you'll have to go back to the Demo Code tab and click Original
and then click Modified and then go back to the Demo tab and it will
fail again.

I have another example with a StaticBox and a Button where the button
will change the box's label color. With that code I can use the button
to change the color both before and after the Tab key causes the color
to change. So the Tab key effect is not required to be the first key or
even early in the process. That code also has the WIT and it only shows
the colors I have set. It never shows the label color as 'blue'.

--
Robin Dunn
Software Craftsman

Just to add to this, it appears that GetForegroundColour is also
broken in 2.8.11 and Windows XP. By default, it returns black even
though the text is blue.

···

On Sep 20, 5:07 pm, Robin Dunn <ro...@alldunn.com> wrote:

On 9/20/10 1:46 PM, Al Mansur wrote:

> There's an issue with the StaticBox label changing back to its default
> color (blue) from whatever it was set to.

> This happens on Windows/XP with wx 2.8.11.

> The problem happens with the Tab key and the Alt key. There may be other
> such keys as well. It seems to be related to tab traversal but it only
> happens one time per window/panel/dialog and then some sort of 'reset'
> is needed to see it again.

> I have an app with a dialog that has a 3 tab notebook each page having 2
> StaticBoxes. Upon entering the dialog all StaticBoxes are shown in
> 'black' (because of a SetForegroundColour('black') call). Typing Tab or
> Alt once will change the StaticBoxes (both of them) to the default
> 'blue'. The change occurs on the key-down; press Alt and the text color
> changes before the key-up. The other notebook tabs are not effected,
> they stay 'black' no matter how many times you hit Tab. One must exit
> and re-enter the dialog to see the effect again. The color change caused
> by the Tab or Alt key press only happens once per instantiation of the
> window.

> An easy way to see this is in the wxPython demo's StaticBox example.

> In the Demo Code tab, right after the line

> box = wx.StaticBox(

> add this line:

> box.SetForegroundColour( "black" )

> then save it.

> Run the demo and hit Tab or Alt and the label color will, erroneously,
> be changed from 'black' to 'blue'. This will only happen once and then
> you'll have to visit the Demo Code tab and then back to the Demo tab to
> get it to happen again. This will work once with Tab and once with Alt
> and then you'll have to go back to the Demo Code tab and click Original
> and then click Modified and then go back to the Demo tab and it will
> fail again.

> I have another example with a StaticBox and a Button where the button
> will change the box's label color. With that code I can use the button
> to change the color both before and after the Tab key causes the color
> to change. So the Tab key effect is not required to be the first key or
> even early in the process. That code also has the WIT and it only shows
> the colors I have set. It never shows the label color as 'blue'.

Uh, using different words to ask the same questions or report the same
problem is *very* unlikely to generate different results than before.
If nobody had any ideas last week then it's doubtful that they will now.
The best thing to do at this point is to create a ticket for it at
trac.wxwidgets.org so it won't be forgotten and then perhaps when
somebody is working on that code again in the future the ticket may
spark some ideas.

--
Robin Dunn
Software Craftsmanhttp://wxPython.org