wxPython Program Written on Mac Works on Mac & Linux But Not Windows?

All,

I know I should have a small example that demonstrates what I'm
talking about in the subject line, but due to a non-disclosure
agreement, I can't. (In the future I may try and work up a small non-
relevant app.) Right now, I'm merely looking for anecdotal evidence
to see if anyone has had a similar problem and/or if they were able to
solve it.

I have a program which uses platebuttons and wx.notebooks. I'm using
XRC and python to construct the program. When I run it on my Macbook,
it works perfectly. When I run it on Linux (natively or in a VM) the
fonts are screwed up but otherwise the program works fine.

When I run the program in Windows, nothing works. No functionality at
all. The labels for the platebuttons show up, but they are not
clickable, and the highlight feature doesn't work. The notebooks
don't show up at all. The only thing that works in Windows seems to
be the "About" part of the program (in the file menu) which is a
simple wx.Messagebox().

I am using Python 2.7 with wxPython 2.8 on all three Operating
Systems.

The windows machine on which I am testing the program is Windows XP,
SP 3, with all the latest patches.

Hi,

All,

I know I should have a small example that demonstrates what I'm
talking about in the subject line, but due to a non-disclosure
agreement, I can't. (In the future I may try and work up a small non-
relevant app.) Right now, I'm merely looking for anecdotal evidence
to see if anyone has had a similar problem and/or if they were able to
solve it.

I have a program which uses platebuttons and wx.notebooks. I'm using
XRC and python to construct the program. When I run it on my Macbook,
it works perfectly. When I run it on Linux (natively or in a VM) the
fonts are screwed up but otherwise the program works fine.

When I run the program in Windows, nothing works. No functionality at
all. The labels for the platebuttons show up, but they are not
clickable, and the highlight feature doesn't work. The notebooks
don't show up at all. The only thing that works in Windows seems to
be the "About" part of the program (in the file menu) which is a
simple wx.Messagebox().

Just saying something doesn't work is far from enough information to
make any good educated guess.

The only thing that I can throw out is that it sounds like there is a
problem with mouse events and my only guess would be that these
controls are inside of a StaticBox. If this is the case make sure that
you created the StaticBox object _before_ any of the controls that are
inside of it. If this is not the case then will need more specific
information about what 'doesn't work' in order to provide you with any
help.

Cody

···

On Sat, Nov 13, 2010 at 3:35 PM, tdahsu <tdahsu@gmail.com> wrote:

As you can see at MakingSampleApps - wxPyWiki we don't want your proprietary code anyway. We ask that people *recreate* their problem when making a sample to send us in order to keep it simple, keep all the code relevant to just the problem with no unrelated crud for us to sift through, and because I believe that most of the time going through that exercise allows people to find and understand the problem for themselves.

···

On 11/13/10 1:35 PM, tdahsu wrote:

All,

I know I should have a small example that demonstrates what I'm
talking about in the subject line, but due to a non-disclosure
agreement, I can't.

--
Robin Dunn
Software Craftsman

I appreciate the responses. I'm not using a StaticBox, but I am using
a FlexGridSizer and two panels (top and bottom).

As to saying something doesn't work - the problem is that it DOES work
- on two out of three operating systems. :wink: Hence my frustration.
I have a friend who is willing to help code but only has a Windows
environment, and so the program is stalled until I can figure this
out.

As to creating a sample app, I'll do that. The issue is that I've got
2,000 lines of Python and about as many XML, so that will not be an
easy task. I know I wasn't following the rules - I was hoping to
avoid that if possible. (It's not, so I'll do it!)

I appreciate all the help! I'll send an email with an attachment as
soon as I've got the sample app.

···

On Nov 14, 1:44 am, Robin Dunn <ro...@alldunn.com> wrote:

On 11/13/10 1:35 PM, tdahsu wrote:

> All,

> I know I should have a small example that demonstrates what I'm
> talking about in the subject line, but due to a non-disclosure
> agreement, I can't.

As you can see athttp://wiki.wxpython.org/MakingSampleAppswe don't
want your proprietary code anyway. We ask that people *recreate* their
problem when making a sample to send us in order to keep it simple, keep
all the code relevant to just the problem with no unrelated crud for us
to sift through, and because I believe that most of the time going
through that exercise allows people to find and understand the problem
for themselves.

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

All,

I’ve attached a very basic program (NOT my program with stuff ripped out - I did read the rules until they were burned into my mind :wink: ) that demonstrates the issue I’m having.

This program has a frame, a panel, and two buttons. One button is a graphic-based platebutton, and the other is a text-based platebutton. On pressing each button, you should see nothing more than a simple wx.Messagebox() message indicating which button you pressed.

On Mac or Linux, this works perfectly.

On Windows, neither of the buttons does anything at all.

Of note: I did, at the beginning on this project, make one change to the platebutton.py code in wxPython (on both my Windows and Mac machines, so this can’t be the reason in my mind). On line 683 of platebutton.py, I changed the line:

if hlight.IsOk():

to

if hlight:

because it was throwing the error message that "string does not have the property “IsOk()” (or something very similar). This I assumed was a small bug and my change allowed me to continue. The code still works on Mac but not on Windows, and I can’t see how that would be the issue (especially since I made the same change in both places.)

Any help is GREATLY appreciated.

Thanks.

basic.zip (11.7 KB)

···

On Sat, Nov 13, 2010 at 4:35 PM, tdahsu tdahsu@gmail.com wrote:

All,

I know I should have a small example that demonstrates what I’m

talking about in the subject line, but due to a non-disclosure

agreement, I can’t. (In the future I may try and work up a small non-

relevant app.) Right now, I’m merely looking for anecdotal evidence

to see if anyone has had a similar problem and/or if they were able to

solve it.

I have a program which uses platebuttons and wx.notebooks. I’m using

XRC and python to construct the program. When I run it on my Macbook,

it works perfectly. When I run it on Linux (natively or in a VM) the

fonts are screwed up but otherwise the program works fine.

When I run the program in Windows, nothing works. No functionality at

all. The labels for the platebuttons show up, but they are not

clickable, and the highlight feature doesn’t work. The notebooks

don’t show up at all. The only thing that works in Windows seems to

be the “About” part of the program (in the file menu) which is a

simple wx.Messagebox().

I am using Python 2.7 with wxPython 2.8 on all three Operating

Systems.

The windows machine on which I am testing the program is Windows XP,

SP 3, with all the latest patches.

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,

All,
I've attached a very basic program (NOT my program with stuff ripped out - I
did read the rules until they were burned into my mind :wink: ) that
demonstrates the issue I'm having.
This program has a frame, a panel, and two buttons. One button is a
graphic-based platebutton, and the other is a text-based platebutton. On
pressing each button, you should see nothing more than a simple
wx.Messagebox() message indicating which button you pressed.
On Mac or Linux, this works perfectly.
On Windows, neither of the buttons does anything at all.

You have the parental hierarchy wrong. The Buttons should be children
of the panel and not the frame. Correcting this should fix your issue.

Of note: I did, at the beginning on this project, make one change to the
platebutton.py code in wxPython (on both my Windows and Mac machines, so
this can't be the reason in my mind). On line 683 of platebutton.py, I
changed the line:
if hlight.IsOk():
to
if hlight:
because it was throwing the error message that "string does not have the
property "IsOk()" (or something very similar). This I assumed was a small
bug and my change allowed me to continue. The code still works on Mac but
not on Windows, and I can't see how that would be the issue (especially
since I made the same change in both places

Not sure what version of the control your using as the version in my
svn doesn't line up with that but it would look like you were passing
in a string instead of a Colour object to the function.

Cody

···

On Sun, Nov 14, 2010 at 3:14 PM, TDahsu TDahsu <tdahsu@gmail.com> wrote:

Cody,

You have the parental hierarchy wrong. The Buttons should be children
of the panel and not the frame. Correcting this should fix your issue.

Thanks - that does fix the issue in the sample program. However, in
my larger program, if I change the buttons to be children of their
respective panels, it still doesn't work in Windows. I assume that I
still have the parental structure wrong.

The larger question, then, is - how do I identify the proper parental
structure? Is it simply a matter of reading the Class definitions in
the API? If I have a button on a notebook tab, is it the child of the
tab, the notebook, the panel, the sizer, or the frame? Some
combination thereof? Or all of them?

I was attaching everything to the frame directly, which I know now is
clearly not the right way to go. Ultimately, I need to be able to
show and hide (and sometimes detach) various things based on where the
user is at any given time.

> Of note: I did, at the beginning on this project, make one change to the
> platebutton.py code in wxPython (on both my Windows and Mac machines, so
> this can't be the reason in my mind). On line 683 of platebutton.py, I
> changed the line:
> if hlight.IsOk():
> to
> if hlight:
> because it was throwing the error message that "string does not have the
> property "IsOk()" (or something very similar). This I assumed was a small
> bug and my change allowed me to continue. The code still works on Mac but
> not on Windows, and I can't see how that would be the issue (especially
> since I made the same change in both places

Not sure what version of the control your using as the version in my
svn doesn't line up with that but it would look like you were passing
in a string instead of a Colour object to the function.

Cody

As to this point, I am indeed passing in a string - a string like
#aaaaaa, which represents the colour. There aren't wx.Colours for all
the colours I want to use, and I thought that the platebutton is
supposed to be able to work with colours in that format.

Thanks!

Hi,

Cody,

You have the parental hierarchy wrong. The Buttons should be children
of the panel and not the frame. Correcting this should fix your issue.

Thanks - that does fix the issue in the sample program. However, in
my larger program, if I change the buttons to be children of their
respective panels, it still doesn't work in Windows. I assume that I
still have the parental structure wrong.

The larger question, then, is - how do I identify the proper parental
structure? Is it simply a matter of reading the Class definitions in
the API? If I have a button on a notebook tab, is it the child of the
tab, the notebook, the panel, the sizer, or the frame? Some
combination thereof? Or all of them?

A control should be the child of its immediate containing object.
Typically there are three category of windows.

1) Top Level Windows (Frames, Dialogs)
2) General containers (Panels, Notebooks, ...)
3) Controls (buttons, checkboxes, ...)

The containment hierarchy in a general sense follows the above, a
Frame contains a Panel and the panel contains the controls.

Not sure what version of the control your using as the version in my
svn doesn't line up with that but it would look like you were passing
in a string instead of a Colour object to the function.

Cody

As to this point, I am indeed passing in a string - a string like
#aaaaaa, which represents the colour. There aren't wx.Colours for all
the colours I want to use, and I thought that the platebutton is
supposed to be able to work with colours in that format.

You can represent any colour with a Colour object. I think that you
are confusing some of the predefined colours objects (i.e wx.RED,
wx.BLACK). To create #aaaaaa you could do wx.Colour(170, 170, 170).

Cody

···

On Sun, Nov 14, 2010 at 4:23 PM, tdahsu <tdahsu@gmail.com> wrote:

Cody,

Please see the attached file. I am still unable to get the platebuttons to show up correctly under Windows in my larger program though I have fixed their parental control to be the panel they are in rather than the frame. (They work in the attached sample app though so I have some debugging to do in my larger program. I can’t quite figure out why they don’t work in my program though the fix works in the sample app.)

I am having an additional problem, in that if I create a notebook it does not show up in Windows.

The attached sample app shows what I mean. The notebook created never shows up. It does on the Mac though.

Thanks.

basic.zip (11.8 KB)

···

On Sun, Nov 14, 2010 at 5:39 PM, Cody Precord codyprecord@gmail.com wrote:

Hi,

On Sun, Nov 14, 2010 at 4:23 PM, tdahsu tdahsu@gmail.com wrote:

Cody,

You have the parental hierarchy wrong. The Buttons should be children

of the panel and not the frame. Correcting this should fix your issue.

Thanks - that does fix the issue in the sample program. However, in

my larger program, if I change the buttons to be children of their

respective panels, it still doesn’t work in Windows. I assume that I

still have the parental structure wrong.

The larger question, then, is - how do I identify the proper parental

structure? Is it simply a matter of reading the Class definitions in

the API? If I have a button on a notebook tab, is it the child of the

tab, the notebook, the panel, the sizer, or the frame? Some

combination thereof? Or all of them?

A control should be the child of its immediate containing object.

Typically there are three category of windows.

  1. Top Level Windows (Frames, Dialogs)

  2. General containers (Panels, Notebooks, …)

  3. Controls (buttons, checkboxes, …)

The containment hierarchy in a general sense follows the above, a

Frame contains a Panel and the panel contains the controls.

Not sure what version of the control your using as the version in my

svn doesn’t line up with that but it would look like you were passing

in a string instead of a Colour object to the function.

Cody

As to this point, I am indeed passing in a string - a string like

#aaaaaa, which represents the colour. There aren’t wx.Colours for all

the colours I want to use, and I thought that the platebutton is

supposed to be able to work with colours in that format.

You can represent any colour with a Colour object. I think that you

are confusing some of the predefined colours objects (i.e wx.RED,

wx.BLACK). To create #aaaaaa you could do wx.Colour(170, 170, 170).

Cody

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Please see the attached file. I am still unable to get the platebuttons to
show up correctly under Windows in my larger program though I have fixed
their parental control to be the panel they are in rather than the frame.
(They work in the attached sample app though so I have some debugging to do
in my larger program. I can't quite figure out why they don't work in my
program though the fix works in the sample app.)

As to this point, I have identified the issue in my larger program:

I have two panels - topPanel, and bottomPanel. Each panel has an
image that forms the background of the panel and fills the entire
panel. If I get rid of the background image in the panel, the buttons
work in Windows.

Is this a bug? I'm going to have to see about changing the entire
background of the program to work around this for now...

It's definitely possible to have working buttons on a panel that is
painted with an image--and have it work on Windows. This tutorial by
Mike Driscoll may help you figure out what you may need to do:

Che

···

On Sun, Nov 14, 2010 at 8:30 PM, tdahsu <tdahsu@gmail.com> wrote:

Please see the attached file. I am still unable to get the platebuttons to
show up correctly under Windows in my larger program though I have fixed
their parental control to be the panel they are in rather than the frame.
(They work in the attached sample app though so I have some debugging to do
in my larger program. I can't quite figure out why they don't work in my
program though the fix works in the sample app.)

As to this point, I have identified the issue in my larger program:

I have two panels - topPanel, and bottomPanel. Each panel has an
image that forms the background of the panel and fills the entire
panel. If I get rid of the background image in the panel, the buttons
work in Windows.

Is this a bug? I'm going to have to see about changing the entire
background of the program to work around this for now...

background of the program to work around this for now...

It's definitely possible to have working buttons on a panel that is
painted with an image--and have it work on Windows. This tutorial by
Mike Driscoll may help you figure out what you may need to do:

http://www.blog.pythonlibrary.org/2010/03/18/wxpython-putting-a-backg

Che

Thanks for the tutorial. I've actually been reading more and more of
Mike's site (finding it very useful) but I hadn't gotten to that part
yet.

I've removed the panels from the program entirely. It occurred to me
that I didn't really need them (or the sizer, for that matter, which I
also removed), and have attached everything to the frame (that isn't
on a notebook tab).

The background is now a child of the frame, and is all one piece.

All platebuttons and notebooks have the frame as their parent.

The platebuttons and notebooks work fine on Mac and Linux.

The platebuttons not only don't work on Windows now, they don't even
place properly anymore.

The notebook still doesn't show up on Windows.

Whoever said Windows was easier never tried to do this!

How are you putting the image in the panels? If it is a wx.StaticBitmap and you want the other widgets to appear on top of it then it is the same parentage problem as you had before. In general, if you want a widget to appear within the bounds of a another widget then they need to have a parent/child relationship. However in this case a wx.StaticBitmap is not intended to be a container of other widgets. So to give a panel an image for a background you'll need to paint it on the panel from the panel's EVT_PAINT event handler. There are some samples of this in the demo.

···

On 11/14/10 5:30 PM, tdahsu wrote:

Please see the attached file. I am still unable to get the platebuttons to
show up correctly under Windows in my larger program though I have fixed
their parental control to be the panel they are in rather than the frame.
  (They work in the attached sample app though so I have some debugging to do
in my larger program. I can't quite figure out why they don't work in my
program though the fix works in the sample app.)

As to this point, I have identified the issue in my larger program:

I have two panels - topPanel, and bottomPanel. Each panel has an
image that forms the background of the panel and fills the entire
panel. If I get rid of the background image in the panel, the buttons
work in Windows.

Is this a bug? I'm going to have to see about changing the entire
background of the program to work around this for now...

--
Robin Dunn
Software Craftsman

  > background of the program to work around this for now...

It's definitely possible to have working buttons on a panel that is
painted with an image--and have it work on Windows. This tutorial by
Mike Driscoll may help you figure out what you may need to do:

http://www.blog.pythonlibrary.org/2010/03/18/wxpython-putting-a-backg

Che

Thanks for the tutorial. I've actually been reading more and more of
Mike's site (finding it very useful) but I hadn't gotten to that part
yet.

I've removed the panels from the program entirely.

You probably don't want to do that, depending on the structure of your UI. The wx.Panel also provides the tab-traversal behavior.

It occurred to me
that I didn't really need them (or the sizer, for that matter, which I
also removed), and have attached everything to the frame (that isn't
on a notebook tab).

The background is now a child of the frame, and is all one piece.

All platebuttons and notebooks have the frame as their parent.

The platebuttons and notebooks work fine on Mac and Linux.

The platebuttons not only don't work on Windows now, they don't even
place properly anymore.

The notebook still doesn't show up on Windows.

Whoever said Windows was easier never tried to do this!

We are able to make correctly written programs to work well on each platform. However we are not able to make incorrectly written programs to misbehave (if at all) the same way on all the platforms. In other words, you are certainly doing something wrong that happens to work or appear to work correctly on Linux and Mac. If you can figure out what it is then your app can work on all platforms.

You may want to try using the WIT. http://wiki.wxpython.org/Widget_Inspection_Tool It can help you not only to visualize the hierarchy of the widgets and sizers in the application, but also to interact with them live via a Python shell.

···

On 11/14/10 9:26 PM, tdahsu wrote:

--
Robin Dunn
Software Craftsman

Robin,

I am aware that the fault is quite likely with me. I am certainly not
so proud as to be unwilling to except help, and I am very grateful for
all the assistance. My frustration is that I picked this because it's
supposed to be cross-platform, and was quite surprised to find that my
(possibly incorrect) efforts yielded something vastly different on
Windows.

With the exception of the one image, all the buttons that I'm using
are platebuttons - merely text. The type - text or bitmap - doesn't
matter - they either all work (Mac) or none do (Windows).

Here's what I had before (I'll try the WIT tomorrow, as it's late, but
I can give you this much now):

Frame
  Sizer
    Top Panel
      Background
      Four Top Platebuttons (Text)
    Bottom Panel
      Background
      One Platebutton (Image)
      Side Platebuttons (Text) <-- Show up based on user input
      Notebooks
         Panels for tabs

Here's what I have now:

Frame
    Background
    Four Top Platebuttons (Text)
    One Platebutton (Image)
    Side Platebuttons (Text) <-- Show up based on user input
    Notebooks
        Panels for tabs

I eliminated the Top Panel, Bottom Panel, and Sizer.

The four top platebuttons stay in view all the time. The one
platebutton that is an image is essentially the "get started" button
at the front and disappears as the first notebook shows up.

The second notebook shows up when the users complete the first. The
third shows up at the end of the second, etc.

Right now, I am simply hiding controls based on program flow. When I
had the sizer, I was also detaching prior to hiding them and re-
attaching prior to showing. (It seems to me that this saves on
memory.) This is easiest to do by creating a list of items to keep,
calling self.frame.GetChildren(), comparing the two, and hiding
anything that's not in the former.

Also, I should note that again, the notebooks do not show up at all in
Windows in either case - how I had the program previously, or how I
have it now. These items are always children of the frame, so unless
a notebook can't be drawn over a background, there's no reason that
that should be the case. Also, it didn't work in the simple app that
I included at 1940 in response to Cody.

Thanks.

···

On Nov 15, 1:24 am, Robin Dunn <ro...@alldunn.com> wrote:

On 11/14/10 9:26 PM, tdahsu wrote:

> > background of the program to work around this for now...

>> It's definitely possible to have working buttons on a panel that is
>> painted with an image--and have it work on Windows. This tutorial by
>> Mike Driscoll may help you figure out what you may need to do:

>>http://www.blog.pythonlibrary.org/2010/03/18/wxpython-putting-a-backg

>> Che

> Thanks for the tutorial. I've actually been reading more and more of
> Mike's site (finding it very useful) but I hadn't gotten to that part
> yet.

> I've removed the panels from the program entirely.

You probably don't want to do that, depending on the structure of your
UI. The wx.Panel also provides the tab-traversal behavior.

> It occurred to me
> that I didn't really need them (or the sizer, for that matter, which I
> also removed), and have attached everything to the frame (that isn't
> on a notebook tab).

> The background is now a child of the frame, and is all one piece.

> All platebuttons and notebooks have the frame as their parent.

> The platebuttons and notebooks work fine on Mac and Linux.

> The platebuttons not only don't work on Windows now, they don't even
> place properly anymore.

> The notebook still doesn't show up on Windows.

> Whoever said Windows was easier never tried to do this!

We are able to make correctly written programs to work well on each
platform. However we are not able to make incorrectly written programs
to misbehave (if at all) the same way on all the platforms. In other
words, you are certainly doing something wrong that happens to work or
appear to work correctly on Linux and Mac. If you can figure out what
it is then your app can work on all platforms.

You may want to try using the WIT.http://wiki.wxpython.org/Widget_Inspection_Tool It can help you not
only to visualize the hierarchy of the widgets and sizers in the
application, but also to interact with them live via a Python shell.

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

Right now, I am simply hiding controls based on program flow. When I
had the sizer, I was also detaching prior to hiding them and re-
attaching prior to showing.

Probably no need to do that. Sizers automatically skip items that are hidden.

(It seems to me that this saves on
memory.) This is easiest to do by creating a list of items to keep,
calling self.frame.GetChildren(), comparing the two, and hiding
anything that's not in the former.

Also, I should note that again, the notebooks do not show up at all in
Windows in either case -

Do they have a size? Are they positioned in a visible area? Do the have colors different than their background? To they overlap other widgets on the same parent? The WIT can help you answer these questions.

how I had the program previously, or how I
have it now. These items are always children of the frame, so unless
a notebook can't be drawn over a background, there's no reason that
that should be the case.

What exactly do you mean by "Background"? Is is a window or is it just setting the color or drawing something on the background of a window from its paint event?

Also, it didn't work in the simple app that
I included at 1940 in response to Cody.

That was because the panel and the notebook occupied the same space (overlapping areas on the screen) but were not parent/child. On Windows the notebook was shown behind the panel, on the other platforms it showed up in front of the panel. Because of difficulties like this wx does not support overlapping sibling windows, (except for top-level windows of course, like wx.Frames.)

···

On 11/14/10 10:58 PM, tdahsu wrote:

--
Robin Dunn
Software Craftsman

> Right now, I am simply hiding controls based on program flow. When I
> had the sizer, I was also detaching prior to hiding them and re-
> attaching prior to showing.

Probably no need to do that. Sizers automatically skip items that are
hidden.

Ok, didn't know that. I'll just continue to hide things then. :wink:

> (It seems to me that this saves on
> memory.) This is easiest to do by creating a list of items to keep,
> calling self.frame.GetChildren(), comparing the two, and hiding
> anything that's not in the former.

> Also, I should note that again, the notebooks do not show up at all in
> Windows in either case -

Do they have a size? Are they positioned in a visible area? Do the
have colors different than their background? To they overlap other
widgets on the same parent? The WIT can help you answer these questions.

The notebooks do have a size - they don't overlap anything (to my
knowledge). I guess my next research will be involved in reading the
WIT output. From what I've seen of it so far it shows pretty much
exactly what I wrote above.

> how I had the program previously, or how I
> have it now. These items are always children of the frame, so unless
> a notebook can't be drawn over a background, there's no reason that
> that should be the case.

What exactly do you mean by "Background"? Is is a window or is it just
setting the color or drawing something on the background of a window
from its paint event?

The background in this case is a wx.StaticBitmap that is attached to
the Frame, and is the same size as the frame. Without it, the program
works in Windows!

> Also, it didn't work in the simple app that
> I included at 1940 in response to Cody.

That was because the panel and the notebook occupied the same space
(overlapping areas on the screen) but were not parent/child. On Windows
the notebook was shown behind the panel, on the other platforms it
showed up in front of the panel. Because of difficulties like this wx
does not support overlapping sibling windows, (except for top-level
windows of course, like wx.Frames.)

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

That makes sense. I am starting to understand this now, and since I
know that the controls work in Windows without the wx.StaticBitmap
background, I'll have to research more into the previously suggested
links on Mike Driscoll's site.

Thanks!

That's, in some sense (if I understand it correctly), Mac and Linux
being "too lenient", not Windows being wrong about it. I mean, if you
have a framed "painting" (the bitmap) that covers a wall and you have
"light switches" (buttons) that are on that same wall, how can you
expect to use the light switches? But, if the painting was *painted
onto the wall itself*, then the light switches wouldn't be covered and
you could use them.

That's probably your fix...do something like (untested):

1) Make a panel that will display your background and hold your
buttons. Make it a child of the frame. (This way allows tab
traversal)

2) Bind the panel's paint method:
  self.myPanel.Bind(wx.EVT_PAINT, self.OnPanelPaint)

3) In that method, use wx.BufferedDC to draw the background on it.

def OnPanelPaint(self,event):
    dc = wx.BufferedPaintDC(self.myPanel)
    myBackground = Images.myBackground.GetBitmap() #using img2py somewhere else
    dc.DrawBitmap(myBackground, 0, 0, True)

Che

···

On Mon, Nov 15, 2010 at 3:19 PM, tdahsu <tdahsu@gmail.com> wrote:

> Right now, I am simply hiding controls based on program flow. When I
> had the sizer, I was also detaching prior to hiding them and re-
> attaching prior to showing.

Probably no need to do that. Sizers automatically skip items that are
hidden.

Ok, didn't know that. I'll just continue to hide things then. :wink:

> (It seems to me that this saves on
> memory.) This is easiest to do by creating a list of items to keep,
> calling self.frame.GetChildren(), comparing the two, and hiding
> anything that's not in the former.

> Also, I should note that again, the notebooks do not show up at all in
> Windows in either case -

Do they have a size? Are they positioned in a visible area? Do the
have colors different than their background? To they overlap other
widgets on the same parent? The WIT can help you answer these questions.

The notebooks do have a size - they don't overlap anything (to my
knowledge). I guess my next research will be involved in reading the
WIT output. From what I've seen of it so far it shows pretty much
exactly what I wrote above.

> how I had the program previously, or how I
> have it now. These items are always children of the frame, so unless
> a notebook can't be drawn over a background, there's no reason that
> that should be the case.

What exactly do you mean by "Background"? Is is a window or is it just
setting the color or drawing something on the background of a window
from its paint event?

The background in this case is a wx.StaticBitmap that is attached to
the Frame, and is the same size as the frame. Without it, the program
works in Windows!

Then like I said, this is exactly the same problem, you have more than one widget trying to occupy the same space without a parent-child relationship. In other words, the wx.StaticBitmap and the others are all children of the frame, but you're trying to use the StaticBitmap as a background for the other widgets.

···

On 11/15/10 12:19 PM, tdahsu wrote:

Right now, I am simply hiding controls based on program flow. When I
had the sizer, I was also detaching prior to hiding them and re-
attaching prior to showing.

Probably no need to do that. Sizers automatically skip items that are
hidden.

Ok, didn't know that. I'll just continue to hide things then. :wink:

(It seems to me that this saves on
memory.) This is easiest to do by creating a list of items to keep,
calling self.frame.GetChildren(), comparing the two, and hiding
anything that's not in the former.

Also, I should note that again, the notebooks do not show up at all in
Windows in either case -

Do they have a size? Are they positioned in a visible area? Do the
have colors different than their background? To they overlap other
widgets on the same parent? The WIT can help you answer these questions.

The notebooks do have a size - they don't overlap anything (to my
knowledge). I guess my next research will be involved in reading the
WIT output. From what I've seen of it so far it shows pretty much
exactly what I wrote above.

how I had the program previously, or how I
have it now. These items are always children of the frame, so unless
a notebook can't be drawn over a background, there's no reason that
that should be the case.

What exactly do you mean by "Background"? Is is a window or is it just
setting the color or drawing something on the background of a window
from its paint event?

The background in this case is a wx.StaticBitmap that is attached to
the Frame, and is the same size as the frame. Without it, the program
works in Windows!

--
Robin Dunn
Software Craftsman

Robin, Cody, Che, et al.,

The issue is fixed! I can't thank you enough for your all your help.

What I did was a bit of a cheat. Rather than use the BufferedDC, I
had the advantage that my background was a white background with a
border around it. I made the frame background white, and but the
border into four pieces, and placed the border pieces into the frame
around the controls so that it *LOOKS* the same but is
programmatically different. The controls are now directly attached to
the frame (unless they are attached to their parent, like in a
notebook), and are no longer competing with the background.

More importantly, the REAL issue that is solved is that *I understand
the problem, and I understand the proper solution*! (This is true
though I cheated to save time.)

Again, I really can't thank you all enough for your patience and
wisdom. It really is genuinely appreciated. If any of you ever find
yourself in the Metro DC area, let me know, and I'll happily buy you a
beer or three. :smiley: