I have a a StaticLine separating some buttons in a StaticBoxSizer. For some reason the StaticLine does not initially draw and only shows up when the window is resized (covering the line). When the GridBagSizer that contains the button layout is outside of a StaticBoxSizer, it shows up with no problem. I have created a test GUI to demonstrate the problem. Any help is greatly appreciated.
I get a similar image here on Win 8.1 with 3.0.0.0 MSW Classic. I also get the PyXmlSubclassFactory * error. It goes away when I comment out the “import wx.xrc” (it still works without that import)
Thanks for your responses. That is interesting, I do not get that error on my machine, although commenting “import wx.xrc” out does not change anything, so I don’t really need it. Based on the post Nathan linked to, that does not seem to be the issue. Any other ideas?
···
On Monday, July 28, 2014 5:01:28 PM UTC-7, Ian Abshire wrote:
I have a a StaticLine separating some buttons in a StaticBoxSizer. For some reason the StaticLine does not initially draw and only shows up when the window is resized (covering the line). When the GridBagSizer that contains the button layout is outside of a StaticBoxSizer, it shows up with no problem. I have created a test GUI to demonstrate the problem. Any help is greatly appreciated.
On Tuesday, July 29, 2014 8:40:30 AM UTC-7, Ian Abshire wrote:
Thanks for your responses. That is interesting, I do not get that error on my machine, although commenting “import wx.xrc” out does not change anything, so I don’t really need it. Based on the post Nathan linked to, that does not seem to be the issue. Any other ideas?
On Monday, July 28, 2014 5:01:28 PM UTC-7, Ian Abshire wrote:
I have a a StaticLine separating some buttons in a StaticBoxSizer. For some reason the StaticLine does not initially draw and only shows up when the window is resized (covering the line). When the GridBagSizer that contains the button layout is outside of a StaticBoxSizer, it shows up with no problem. I have created a test GUI to demonstrate the problem. Any help is greatly appreciated.
On Tuesday, July 29, 2014 9:19:22 AM UTC-7, Nathan McCorkle wrote:
try self.Refresh() after self.Centre(wx.BOTH )
On Tuesday, July 29, 2014 8:40:30 AM UTC-7, Ian Abshire wrote:
Thanks for your responses. That is interesting, I do not get that error on my machine, although commenting “import wx.xrc” out does not change anything, so I don’t really need it. Based on the post Nathan linked to, that does not seem to be the issue. Any other ideas?
On Monday, July 28, 2014 5:01:28 PM UTC-7, Ian Abshire wrote:
I have a a StaticLine separating some buttons in a StaticBoxSizer. For some reason the StaticLine does not initially draw and only shows up when the window is resized (covering the line). When the GridBagSizer that contains the button layout is outside of a StaticBoxSizer, it shows up with no problem. I have created a test GUI to demonstrate the problem. Any help is greatly appreciated.
I have a a StaticLine separating some buttons in a StaticBoxSizer. For
some reason the StaticLine does not initially draw and only shows up when
the window is resized (covering the line). When the GridBagSizer that
contains the button layout is outside of a StaticBoxSizer, it shows up with
no problem. I have created a test GUI to demonstrate the problem. Any help
is greatly appreciated.
This works on wxPython 2.8.12, but that's besides the point.
I tried it with 2.9.4, got the error, and then re-did it with one change:
you are adding everything directly to the frame. Try placing a wxPanel as
the first object (and setting the sizer on that instead of the frame
itself) and then adding the various widgets to that panel, including the
staticLine. I partially tested it (didn't bother to deal with the sizers),
and the line showed up.
Che
···
On Mon, Jul 28, 2014 at 8:01 PM, Ian Abshire <ianabshire@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
P.S. in case Che wasn’t clear enough, you’re creating your widgets with self as the parent, Che is saying to make a Panel and use that as the parent for all the widgets. You don’t need to set the Panel to the Frame, since you pass self (the Frame) to the Panel when you construct it.
···
On Tuesday, July 29, 2014 12:29:35 PM UTC-7, Che M wrote:
you are adding everything directly to the frame. Try placing a wxPanel as the first object (and setting the sizer on that instead of the frame itself) and then adding the various widgets to that panel, including the staticLine.
Have I missed something? I’m not sure if I implemented your suggestion incorrectly, or if it didn’t work. Thanks for the help!
···
On Tuesday, July 29, 2014 1:18:55 PM UTC-7, Nathan McCorkle wrote:
On Tuesday, July 29, 2014 12:29:35 PM UTC-7, Che M wrote:
you are adding everything directly to the frame. Try placing a wxPanel as the first object (and setting the sizer on that instead of the frame itself) and then adding the various widgets to that panel, including the staticLine.
Great catch, I have a feeling that is the issue!
P.S. in case Che wasn’t clear enough, you’re creating your widgets with self as the parent, Che is saying to make a Panel and use that as the parent for all the widgets. You don’t need to set the Panel to the Frame, since you pass self (the Frame) to the Panel when you construct it.
works for me, even just doing self=wx.Panel(self) after the wx.Frame.__init works
see the more-sane looking code (which works for me)
I did notice that the self.SetSizeHintsSz didn’t seem to be working to make the min size such that the widgets won’t be hidden (frame can’t be sized too small)… but I fixed that with gbSizer_outer.SetSizeHints(self) after setting the sizer
Have I missed something? I’m not sure if I implemented your suggestion incorrectly, or if it didn’t work. Thanks for the help!
On Tuesday, July 29, 2014 1:18:55 PM UTC-7, Nathan McCorkle wrote:
On Tuesday, July 29, 2014 12:29:35 PM UTC-7, Che M wrote:
you are adding everything directly to the frame. Try placing a wxPanel as the first object (and setting the sizer on that instead of the frame itself) and then adding the various widgets to that panel, including the staticLine.
Great catch, I have a feeling that is the issue!
P.S. in case Che wasn’t clear enough, you’re creating your widgets with self as the parent, Che is saying to make a Panel and use that as the parent for all the widgets. You don’t need to set the Panel to the Frame, since you pass self (the Frame) to the Panel when you construct it.
I made the changes you suggested to the sample app, and they work. I then tried to do the same thing to my actual application, and the problem persisted. I then realized in my actual application I am changing the color with:
Have I missed something? I’m not sure if I implemented your suggestion incorrectly, or if it didn’t work. Thanks for the help!
On Tuesday, July 29, 2014 1:18:55 PM UTC-7, Nathan McCorkle wrote:
On Tuesday, July 29, 2014 12:29:35 PM UTC-7, Che M wrote:
you are adding everything directly to the frame. Try placing a wxPanel as the first object (and setting the sizer on that instead of the frame itself) and then adding the various widgets to that panel, including the staticLine.
Great catch, I have a feeling that is the issue!
P.S. in case Che wasn’t clear enough, you’re creating your widgets with self as the parent, Che is saying to make a Panel and use that as the parent for all the widgets. You don’t need to set the Panel to the Frame, since you pass self (the Frame) to the Panel when you construct it.
I did notice that the self.SetSizeHintsSz didn’t seem to be working to make the min size such that the widgets won’t be hidden (frame can’t be sized too small)… but I fixed that with gbSizer_outer.SetSizeHints(self) after setting the sizer
On Tuesday, July 29, 2014 2:26:28 PM UTC-7, Ian Abshire wrote:
Using your sample code, with the set colour, on my machine:
of course it is entirely possible that you are setting the
background colour to too near your themes line colour to easily see
the line…
Gadget/Steve
I made the changes you suggested to the sample app,
and they work. I then tried to do the same thing to my actual
application, and the problem persisted. I then realized in my
actual application I am changing the color with:
self.SetBackgroundColour( wx.Colour( 197, 206, 209 ) )
When I add this to the sample app, the lines disappear again.
Hm that’s strange. I wonder why it wouldn’t work on my machine. The color isn’t the issue, because resize (hiding the line, and then unhiding the line) makes the line show up, and it is visible.
···
On Tuesday, July 29, 2014 9:59:09 PM UTC-7, Gadget Steve wrote:
On 30/07/14 00:29, Ian Abshire wrote:
I made the changes you suggested to the sample app,
and they work. I then tried to do the same thing to my actual
application, and the problem persisted. I then realized in my
actual application I am changing the color with:
self.SetBackgroundColour( wx.Colour( 197, 206, 209 ) )
When I add this to the sample app, the lines disappear again.
Any ideas why? Thanks!
Using your sample code, with the set colour, on my machine:
<img src="https://groups.google.com/group/wxpython-users/attach/3c1434ff94ca76f0/eagiedhd.png?part=0.1.1&authuser=0" alt="">
of course it is entirely possible that you are setting the
background colour to too near your themes line colour to easily see
the line…
On Wednesday, July 30, 2014 8:42:37 AM UTC-7, Ian Abshire wrote:
Hm that’s strange. I wonder why it wouldn’t work on my machine. The color isn’t the issue, because resize (hiding the line, and then unhiding the line) makes the line show up, and it is visible.
On Tuesday, July 29, 2014 9:59:09 PM UTC-7, Gadget Steve wrote:
On 30/07/14 00:29, Ian Abshire wrote:
I made the changes you suggested to the sample app,
and they work. I then tried to do the same thing to my actual
application, and the problem persisted. I then realized in my
actual application I am changing the color with:
self.SetBackgroundColour( wx.Colour( 197, 206, 209 ) )
When I add this to the sample app, the lines disappear again.
Any ideas why? Thanks!
Using your sample code, with the set colour, on my machine:
<img src="https://groups.google.com/group/wxpython-users/attach/3c1434ff94ca76f0/eagiedhd.png?part=0.1.1&authuser=0" alt="">
of course it is entirely possible that you are setting the
background colour to too near your themes line colour to easily see
the line…
Odd. Two things I could suggest trying (I haven't tried):
1) Try calling the SetBackgroundColour() on the panel. Currently, you're
calling it on the Frame. If this works, I don't understand why yet.
2) Try reparenting things such that the StaticBox is the parent of the
widgets, NOT the panel. To quote Robin Dunn from this list: "The
recommendation is now [wx2.9 +] to use a parent/child relationship between
the staticbox and the widgets contained in it,".
Che
···
On Tue, Jul 29, 2014 at 7:29 PM, Ian Abshire <ianabshire@gmail.com> wrote:
I made the changes you suggested to the sample app, and they work. I then
tried to do the same thing to my actual application, and the problem
persisted. I then realized in my actual application I am changing the color
with:
Torsten, you are correct. Adding the CallAfter does make them display correctly, although it is a work around. I am still curious what the cause is and how to fix it, but at least I now have a way to make it work, so thank you!
Che, I tried #1 with no luck. I may be misunderstanding what you mean for #2, but I tried swapping panel with analyzeImageBox in the widgets, like such:
I made the changes you suggested to the sample app, and they work. I then tried to do the same thing to my actual application, and the problem persisted. I then realized in my actual application I am changing the color with:
When I add this to the sample app, the lines disappear again. Any ideas why? Thanks!
Odd. Two things I could suggest trying (I haven’t tried):
Try calling the SetBackgroundColour() on the panel. Currently, you’re calling it on the Frame. If this works, I don’t understand why yet.
Try reparenting things such that the StaticBox is the parent of the widgets, NOT the panel. To quote Robin Dunn from this list: “The recommendation is now [wx2.9 +] to use a parent/child relationship between the staticbox and the widgets contained in it,”.
I believe the problem with #2 above is that you aren’t saving the StaticBox, which is what the parent should be, not the StaticBoxSizer. Split that line into two, and use the StaticBox object for the StaticBoxSizer constructor as well as for the other widgets.
···
On Wednesday, July 30, 2014 11:31:50 AM UTC-7, Ian Abshire wrote:
Torsten, you are correct. Adding the CallAfter does make them display correctly, although it is a work around. I am still curious what the cause is and how to fix it, but at least I now have a way to make it work, so thank you!
Che, I tried #1 with no luck. I may be misunderstanding what you mean for #2, but I tried swapping panel with analyzeImageBox in the widgets, like such:
I made the changes you suggested to the sample app, and they work. I then tried to do the same thing to my actual application, and the problem persisted. I then realized in my actual application I am changing the color with:
When I add this to the sample app, the lines disappear again. Any ideas why? Thanks!
Odd. Two things I could suggest trying (I haven’t tried):
Try calling the SetBackgroundColour() on the panel. Currently, you’re calling it on the Frame. If this works, I don’t understand why yet.
Try reparenting things such that the StaticBox is the parent of the widgets, NOT the panel. To quote Robin Dunn from this list: “The recommendation is now [wx2.9 +] to use a parent/child relationship between the staticbox and the widgets contained in it,”.
Nathan, you are correct, that was the issue. It is working now. Thank you everyone for your help!
···
On Wednesday, July 30, 2014 12:06:22 PM UTC-7, Nathan McCorkle wrote:
I believe the problem with #2 above is that you aren’t saving the StaticBox, which is what the parent should be, not the StaticBoxSizer. Split that line into two, and use the StaticBox object for the StaticBoxSizer constructor as well as for the other widgets.
On Wednesday, July 30, 2014 11:31:50 AM UTC-7, Ian Abshire wrote:
Torsten, you are correct. Adding the CallAfter does make them display correctly, although it is a work around. I am still curious what the cause is and how to fix it, but at least I now have a way to make it work, so thank you!
Che, I tried #1 with no luck. I may be misunderstanding what you mean for #2, but I tried swapping panel with analyzeImageBox in the widgets, like such:
I made the changes you suggested to the sample app, and they work. I then tried to do the same thing to my actual application, and the problem persisted. I then realized in my actual application I am changing the color with:
When I add this to the sample app, the lines disappear again. Any ideas why? Thanks!
Odd. Two things I could suggest trying (I haven’t tried):
Try calling the SetBackgroundColour() on the panel. Currently, you’re calling it on the Frame. If this works, I don’t understand why yet.
Try reparenting things such that the StaticBox is the parent of the widgets, NOT the panel. To quote Robin Dunn from this list: “The recommendation is now [wx2.9 +] to use a parent/child relationship between the staticbox and the widgets contained in it,”.