Hey people,
I'm using wxGlade to create a grid in a window with a wx.FlexGridSizer. It's
created in code that wxGlade generates, and I'm subclassing that so I can keep
modifying the generated code without clobbering my changes.
The problem is that I need access to the sizer so I can add to it at runtime,
dynamically adding rows, deleting rows, etc.
Any suggestions? I'm fairly new to wxPython.
Thanks,
Mike
···
--
Michael P. Soulier <msoulier@digitaltorque.ca>
"Those who would give up esential liberty for temporary safety deserve
neither liberty nor safety." --Benjamin Franklin
Hi Mike,
the things are rather simple with wxGlade. All the elements you see are members of the first custom panel in their hierarchy or members of the frame.
so if you have in your design a frame and inside that design you don't declare some custom class panel, all the elements are members of the frame.
for example I do this:
I output all the code in a file named interface.py
then in my view code I do something like:
frame = MyFrame()
from now on all I have to do to access a sizer or an element or whatever.... is:
frame.element
or
frame.main_sizer
if you want to structure your GUI elements add them to a custom panel (set the class of the panel to something different than wxPanel like MyFirstPanel) and then access them like:
frame.my_custom_panel.widgetX
If you don't use a custom class panel the widgetX will end up being a member of frame.
if you play with dynamic stuff you might end up (like me) in a situation where the main design in glade is larger than the screen. Editing such a design is very difficult so I do this: I create the custom panels in glade as individual panels and join them all together by hand in a gui.py (here I create the main frame) then is business as usual.
Peter.
···
On Fri, 02 Sep 2005 05:23:39 +0300, Michael P. Soulier <msoulier@digitaltorque.ca> wrote:
Hey people,
I'm using wxGlade to create a grid in a window with a wx.FlexGridSizer. It's
created in code that wxGlade generates, and I'm subclassing that so I can keep
modifying the generated code without clobbering my changes.
The problem is that I need access to the sizer so I can add to it at runtime,
dynamically adding rows, deleting rows, etc.
Any suggestions? I'm fairly new to wxPython.
Thanks,
Mike