My app, senso_editor.py (attached to this Email), has 3 tabs: Settings, Ships, and Targets. Within each of these tabs are panels which contain many other windows organized by sizers.
For some reason, though, the sizers in the Ships and Targets tabs aren’t working correctly. The one in the Ships tab starts up OK, but doesn’t change as the frame is resized. The one on the Targets tab starts out not working at all, then starts working when you resize the window.
The problem showed up when I added sizers to the Targets tab and disappears when I comment out the entire code for that tab (lines 280-443). This at first made me think that it could maybe be a naming conflict (though to my understanding, names have little to no bearing in wxPython), but when I tried renaming all the sizers in the Ships tab, it had no effect (as I expected).
Can anyone see what is causing this? I can’t for the life of me understand why the sizers are behaving the way they are. Could it perhaps be my OS (which is Windows Vista) or a wxPython issue/bug? Or is it an issue with my code that I’m not noticing?
BTW: Each of the tabs has a comment right before the code generating them: “Settings tab” (line 65), “Ships tab” (line 141), and “Targets tab” (line 280). Hope this saves you some time needlessly searching through my code.
My app, senso_editor.py (attached to this Email), has 3 tabs: Settings,
Ships, and Targets. Within each of these tabs are panels which contain many
other windows organized by sizers.
For some reason, though, the sizers in the Ships and Targets tabs aren't
working correctly. The one in the Ships tab starts up OK, but doesn't change
as the frame is resized. The one on the Targets tab starts out not working
at all, then starts working when you resize the window.
The problem showed up when I added sizers to the Targets tab and disappears
when I comment out the entire code for that tab (lines 280-443). This at
first made me think that it could maybe be a naming conflict (though to my
understanding, names have little to no bearing in wxPython), but when I
tried renaming all the sizers in the Ships tab, it had no effect (as I
expected).
Can anyone see what is causing this? I can't for the life of me understand
why the sizers are behaving the way they are. Could it perhaps be my OS
(which is Windows Vista) or a wxPython issue/bug? Or is it an issue with my
code that I'm not noticing?
BTW: Each of the tabs has a comment right before the code generating them:
"Settings tab" (line 65), "Ships tab" (line 141), and "Targets tab" (line
280). Hope this saves you some time needlessly searching through my code.
Your calling SetSizer on the wrong Panel:
"""
hbox.Add(vbox2, 3, wx.EXPAND)
ships.SetSizer(hbox)
tabs.AddPage(targets, 'Targets')
"""
Should be 'targets.SetSizer'.
p.s) You may want to refactor your code to define separate Panel
derived classes for each tab to help simplify and encapsulate behavior
in your code a little better.
Cody
···
On Tue, Jul 20, 2010 at 3:00 PM, 音本四 <onpon4@gmail.com> wrote: