wx.AUI question, please help

I want to use wx.AUI as a base for my application but I have
one problem and I don’t know how to solve it. In the wxpython demo there
is an AUI_DockingWindowMgr example. What I’am trying to do is to display
certain controls when clicking certain items from the tree in the left panel.
For example when I click item1 in the tree I want to appear a checkbox in the right
panel, click item2 I want to appear a grid or something else in the right
panel. For few controls it’s possible to use Hide() for the same panel
but when I have many controls to display it’s not a very good solution. There
must be a better solution. Anyone have an idea ?

Thank you.

Mihai George - mihai@gfitemasoft.com

Tester - GFI Software - www.gfi.com

Messaging, Content Security & Network Security Software

···

Hi Mihai,

The solution is too obvious and that is why you might have missed it :slight_smile:
Put all the components on a Panel and hide that panel :slight_smile:
:slight_smile:

Peter

···

On Nov 26, 2007 12:44 PM, Mihai George < mihai@gfitemasoft.com> wrote:

I want to use wx.AUI as a base for my application but I have
one problem and I don’t know how to solve it. In the wxpython demo there
is an AUI_DockingWindowMgr example. What I’am trying to do is to display
certain controls when clicking certain items from the tree in the left panel.
For example when I click item1 in the tree I want to appear a checkbox in the right
panel, click item2 I want to appear a grid or something else in the right
panel. For few controls it’s possible to use Hide() for the same panel
but when I have many controls to display it’s not a very good solution. There
must be a better solution. Anyone have an idea ?

Thank you.

Mihai George - mihai@gfitemasoft.com

Tester - GFI Software - www.gfi.com

Messaging, Content Security & Network Security Software


There is NO FATE, we are the creators.

Hi Stef,

Andrea Gavana wrote:
> Hi,
>
>
>> I want to use wx.AUI as a base for my application but I have one problem and
>> I don't know how to solve it. In the wxpython demo there is an
>> AUI_DockingWindowMgr example. What I'am trying to do is to display certain
>> controls when clicking certain items from the tree in the left panel. For
>> example when I click item1 in the tree I want to appear a checkbox in the
>> right panel, click item2 I want to appear a grid or something else in the
>> right panel. For few controls it's possible to use Hide() for the same panel
>> but when I have many controls to display it's not a very good solution.
>> There must be a better solution. Anyone have an idea ?
>>
>
> It seems like a job for a notebook control, using a tree control to
> change pages instead of tabs. It can be done also with wxAUI, no
> doubt, but you still have to build a diffrent panel for every
> different view (or Hide() and Show() controls on the same panel as you
> switch your tree items).
why not rebuild the panel dynamically ?
(as I'm doing this right now :wink:

Yes, this is another possibility as well. Obviously the best approach
depends on how complex the panel is, as rebuilding a very complex
panel might take longer than having a panel already built but hidden.
I have no idea of the complexity of the OP panels :smiley:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Nov 26, 2007 10:56 AM, Stef Mientki wrote:

> On Nov 26, 2007 10:44 AM, Mihai George wrote:

hi Michael, Andrea

michael michael wrote:

Andrea, can widget stack be used together with wx.AUI or not ? Widget stack is exactly what I want but I would like to use wx.AUI also because I think is a bit more elegant.
The idea is that when a tree item is added a new panel must be dynamically created, so a connection between the tree item and panel is essential. Panels will contain a grid control and perhaps a few buttons. Cells are added to grid control depending on user actions.

We're not designing the same program, are we ?
Michael, what's your application ?
(Mine application: ( SciPy + wxPython ) > ( MatLab + LabView ) :wink:
What's a widget stack, any links ?
(Maybe I can still improve my design, hope to have a demo movie at the end of the week)

    > > It seems like a job for a notebook control, using a tree
    control to
    > > change pages instead of tabs. It can be done also with wxAUI, no
    > > doubt, but you still have to build a diffrent panel for every
    > > different view (or Hide() and Show() controls on the same
    panel as you
    > > switch your tree items).
    > why not rebuild the panel dynamically ?
    > (as I'm doing this right now :wink:

    Yes, this is another possibility as well. Obviously the best approach
    depends on how complex the panel is, as rebuilding a very complex
    panel might take longer than having a panel already built but hidden.
    I have no idea of the complexity of the OP panels :smiley:

Yes you're right, but from the description I guess they are not too complex.

cheers,
Stef

Het UMC St Radboud staat geregistreerd bij de Kamer van Koophandel in het handelsregister onder nummer 41055629.
The Radboud University Nijmegen Medical Centre is listed in the Commercial Register of the Chamber of Commerce under file number 41055629.

Hi Michael,

Andrea, can widget stack be used together with wx.AUI or not ? Widget stack
is exactly what I want but I would like to use wx.AUI also because I think
is a bit more elegant.
The idea is that when a tree item is added a new panel must be dynamically
created, so a connection between the tree item and panel is essential.
Panels will contain a grid control and perhaps a few buttons. Cells are
added to grid control depending on user actions.
What is the best approach in this case ?

You can use wxAUI to do that, without problems. I didn't probably
understand your question very well, but you could do something like
that:

1) Create a wx.TreeCtrl on the left (or right, whatever you like),
docking it with wx.AUI:

self._mgr.AddPane(MyTreeControl,
wx.aui.AuiPaneInfo().Left().Caption("My Caption").Name("MyTree")

2) You bind a wx.EVT_TREE_SEL_CHANGED event to catch the item
selection changing:

MyTreeCtrl.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged)

def OnSelChanged(self, event):

    item = event.GetItem()
    # depending on the chosen item do your pre-processing, and then...

    oldPane = self._mgr.GetPane("paneYouWantToHide")
    oldPane.Hide()

    newPane = self._mgr.GetPane("paneYouWantToShow")
    newPane.Show() # you can use also CenterPane() or Right() or whatever

    self._mgr.Update()

This requires that you build all the panes you need during
initialization. The other approach, suggested by Stef, is that you
create your panes on the fly inside the OnSelChanged event: you can
add them to the wxAUI manager, hide the old one, show the freshly
created one.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Nov 26, 2007 12:07 PM, michael michael wrote:

michael michael wrote:

My application is more like a hobby application,

well mine is also "just" a hobby project :wink:

something like a management application,

Interesting, would love to see it when it's finished.

anyway nothing close to scipy :slight_smile:

and I'm just "using" Scipy !

cheers,
Stef

Het UMC St Radboud staat geregistreerd bij de Kamer van Koophandel in het handelsregister onder nummer 41055629.
The Radboud University Nijmegen Medical Centre is listed in the Commercial Register of the Chamber of Commerce under file number 41055629.