Layout problem

I am having the following layout problem with wxPython
2.8.10.1 on Linux:

I have a dialog class with a main sizer (box) and two sub
sizers (both box). The upper sizer contains a
ScrolledWindow, the lower one a few buttons.

In my code I create more ScrolledWindows. They each contain
a grid sizer with labels on the left and text ctrls etc on
the right.

I then re-parent those ScrolledWindows into instances of the
dlg class with the following code:

  # replace dummy panel
  old_ea = self._PNL_ea
  ea_pnl_szr = old_ea.GetContainingSizer()
  ea_pnl_parent = old_ea.GetParent()
  ea_pnl_szr.Remove(old_ea)
  del old_ea
  new_ea.Reparent(ea_pnl_parent)
  self._PNL_ea = new_ea
  ea_pnl_szr.Add(self._PNL_ea, 1, wx.EXPAND, 0)

  ...

  # redraw layout
  self.Layout()
  main_szr = self.GetSizer()
  main_szr.Fit(self)
  self.Refresh()

  self._PNL_ea.refresh()

(within the class the original scrolled window has the same
sizer, same parent, and same .Add() arguments)

The problem is this: The lower sizer/scrolled window with
the buttons is partially or completely overlaid by the upper
sizer/scrolled window until I resize the dialog manually.

Enlarging the dialog "enough" will remove the glitch.

Enlarging it not "enough" partially reveals the buttons.

Even after enlarging the dialog "enough" making it
sufficiently small again will again obstruct the buttons
fully or partially just like directly after creation.

Attached find 2 screen shots with partially obstructed
buttons. The other screenshot shows the way it should be
with fully visible buttons.

I did check the upper part grid sizer to not contain more
rows and columns than are needed.

Attached find the wxGlade generated Python code.

Anyone has any idea what to do ?

Karsten

screenshot_001.jpeg

screenshot_002.jpeg

wxgGenericEditAreaDlg2.py (4.71 KB)

···

--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

How do I duplicate the problem in your sample code?

···

On 3/29/10 12:09 PM, Karsten Hilbert wrote:

I am having the following layout problem with wxPython
2.8.10.1 on Linux:

I have a dialog class with a main sizer (box) and two sub
sizers (both box). The upper sizer contains a
ScrolledWindow, the lower one a few buttons.

In my code I create more ScrolledWindows. They each contain
a grid sizer with labels on the left and text ctrls etc on
the right.

I then re-parent those ScrolledWindows into instances of the
dlg class with the following code:

  # replace dummy panel
  old_ea = self._PNL_ea
  ea_pnl_szr = old_ea.GetContainingSizer()
  ea_pnl_parent = old_ea.GetParent()
  ea_pnl_szr.Remove(old_ea)
  del old_ea
  new_ea.Reparent(ea_pnl_parent)
  self._PNL_ea = new_ea
  ea_pnl_szr.Add(self._PNL_ea, 1, wx.EXPAND, 0)

  ...

  # redraw layout
  self.Layout()
  main_szr = self.GetSizer()
  main_szr.Fit(self)
  self.Refresh()

  self._PNL_ea.refresh()

(within the class the original scrolled window has the same
  sizer, same parent, and same .Add() arguments)

The problem is this: The lower sizer/scrolled window with
the buttons is partially or completely overlaid by the upper
sizer/scrolled window until I resize the dialog manually.

Enlarging the dialog "enough" will remove the glitch.

Enlarging it not "enough" partially reveals the buttons.

Even after enlarging the dialog "enough" making it
sufficiently small again will again obstruct the buttons
fully or partially just like directly after creation.

Attached find 2 screen shots with partially obstructed
buttons. The other screenshot shows the way it should be
with fully visible buttons.

I did check the upper part grid sizer to not contain more
rows and columns than are needed.

Attached find the wxGlade generated Python code.

--
Robin Dunn
Software Craftsman

...

>Attached find the wxGlade generated Python code.

How do I duplicate the problem in your sample code?

You can't. I was hoping someone might see something that
jumps right out.

Now, can I entice you to download a tarball of GNUmed and
reproduce it there or will I absolutely need to create a
runnable sample ? That'd be taking a while (but then
that's my problem, not yours).

Karsten

···

On Mon, Mar 29, 2010 at 12:50:57PM -0700, Robin Dunn wrote:
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

No, I can't take the time to learn the full app enough to be able to diagnose something like this.

BTW, have you tried using the WIT? I find that it helps tremendously in figuring out what is going wrong in layout problems, and once that is done it is usually not too hard to find a solution or a workaround. http://wiki.wxpython.org/Widget_Inspection_Tool

···

On 3/30/10 4:44 AM, Karsten Hilbert wrote:

On Mon, Mar 29, 2010 at 12:50:57PM -0700, Robin Dunn wrote:

...

Attached find the wxGlade generated Python code.

How do I duplicate the problem in your sample code?

You can't. I was hoping someone might see something that
jumps right out.

Now, can I entice you to download a tarball of GNUmed and
reproduce it there or will I absolutely need to create a
runnable sample ? That'd be taking a while (but then
that's my problem, not yours).

--
Robin Dunn
Software Craftsman

Now, can I entice you to download a tarball of GNUmed and
reproduce it there or will I absolutely need to create a
runnable sample ? That'd be taking a while (but then
that's my problem, not yours).

No, I can't take the time to learn the full app enough to be able to
diagnose something like this.

I pretty much knew that much :wink: Anyway, I was hoping for a
lucky streak.

BTW, have you tried using the WIT? I find that it helps
tremendously in figuring out what is going wrong in layout problems,
and once that is done it is usually not too hard to find a solution
or a workaround. http://wiki.wxpython.org/Widget_Inspection_Tool

In fact, no I haven't although the GUI already has access to
the WIT built in if started with --debug.

Will do that - any typical problem pattern I should look for ?

Other than that I may have to actually create the Small
Runnable Sample(tm).

Thanks,
Karsten

···

On Tue, Mar 30, 2010 at 08:59:01AM -0700, Robin Dunn wrote:
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Dang, this ain't that straigt-forward either because the
dialogs to debug are ShowModal() ... :slight_smile:

Karsten

···

On Tue, Mar 30, 2010 at 11:13:38PM +0200, Karsten Hilbert wrote:

> BTW, have you tried using the WIT? I find that it helps
> tremendously in figuring out what is going wrong in layout problems,
> and once that is done it is usually not too hard to find a solution
> or a workaround. http://wiki.wxpython.org/Widget_Inspection_Tool

In fact, no I haven't although the GUI already has access to
the WIT built in if started with --debug.

Will do that - any typical problem pattern I should look for ?

--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

I found that the WIT retains sufficient data on the
offending dialogs even after they were closed from their
ShowModal() invocation (it didn't have details but the tree
structure was still there).

It turned out that the original (dummy) ScrolledWindow was
being properly replaced but still existing inside the
dialogs. Adding an explicit dummy_scrolled_window.Destroy()
at the proper place nicely got rid of the problem it seems
:slight_smile:

Thanks,
Karsten

···

On Tue, Mar 30, 2010 at 08:59:01AM -0700, Robin Dunn wrote:

BTW, have you tried using the WIT? I find that it helps
tremendously in figuring out what is going wrong in layout problems,
and once that is done it is usually not too hard to find a solution
or a workaround. http://wiki.wxpython.org/Widget_Inspection_Tool

--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

If you use the InspectionMixin class mixed with your wx.App class then you can use the hotkey while the modal dialog is active to open the inspection tool.

···

On 3/30/10 2:19 PM, Karsten Hilbert wrote:

On Tue, Mar 30, 2010 at 11:13:38PM +0200, Karsten Hilbert wrote:

BTW, have you tried using the WIT? I find that it helps
tremendously in figuring out what is going wrong in layout problems,
and once that is done it is usually not too hard to find a solution
or a workaround. http://wiki.wxpython.org/Widget_Inspection_Tool

In fact, no I haven't although the GUI already has access to
the WIT built in if started with --debug.

Will do that - any typical problem pattern I should look for ?

Dang, this ain't that straigt-forward either because the
dialogs to debug are ShowModal() ... :slight_smile:

--
Robin Dunn
Software Craftsman

Well, I Show()ed the inspection frame from within the modal
dialog's __init__() just after reparenting the offending
ScrolledWindow. But it still didn't let me use the
inspection frame.

(just saying, the initial problem is solved)

Karsten

···

On Tue, Mar 30, 2010 at 05:45:10PM -0700, Robin Dunn wrote:

>Dang, this ain't that straigt-forward either because the
>dialogs to debug are ShowModal() ... :slight_smile:

If you use the InspectionMixin class mixed with your wx.App class
then you can use the hotkey while the modal dialog is active to open
the inspection tool.

--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346