wxPython and window sizing

V

Ville Voipio

I have a small problem; I would like to have a reasonable
minimum size for a wx.Window.

A simplified version of my code:


s = wx.SplitterWindow(self, -1)

curves = wx.Notebook(s)
curve = wx.Window(curves, ID_BLANKCURVE, style=wx.SUNKEN_BORDER,
size=(300,200))
curves.AddPage(curve, "Blank")

textbox = wx.TextCtrl(s, ID_TEXTBOX, style=wx.TE_MULTILINE,
size=(-1,50))

s.SetMinimumPaneSize(50)
s.SplitHorizontally(curves, textbox)
s.SetSashGravity(0.8)


Here 'self' is the main window class, i.e. inherited from wx.Frame.

What I would like to happen is that both the curve area and the
textbox would have an absolute minimum size when moving the
sash or resizing the window.

How to get this behaviour? I have tried setting the minimum sizes
of the curve and the textbox by using the SetMinSize() method,
but this does not seem to affect anything.

Already when the window is shown the upper pane (i.e. the notebook
curves) is smaller than (300,200) set in the code.

TIA,

- Ville
 
F

Franz GEIGER

Ville said:
I have a small problem; I would like to have a reasonable
minimum size for a wx.Window.

A simplified version of my code:


s = wx.SplitterWindow(self, -1)

curves = wx.Notebook(s)
curve = wx.Window(curves, ID_BLANKCURVE, style=wx.SUNKEN_BORDER,
size=(300,200))
curves.AddPage(curve, "Blank")

textbox = wx.TextCtrl(s, ID_TEXTBOX, style=wx.TE_MULTILINE,
size=(-1,50))

s.SetMinimumPaneSize(50)
s.SplitHorizontally(curves, textbox)
s.SetSashGravity(0.8)


Here 'self' is the main window class, i.e. inherited from wx.Frame.

What I would like to happen is that both the curve area and the
textbox would have an absolute minimum size when moving the
sash or resizing the window.

How to get this behaviour? I have tried setting the minimum sizes
of the curve and the textbox by using the SetMinSize() method,
but this does not seem to affect anything.

Already when the window is shown the upper pane (i.e. the notebook
curves) is smaller than (300,200) set in the code.

TIA,

- Ville


Couldn't you register for a handler? It would be called on changing size or
on moving the sash's slider. And w/i that handler you could resize the
window to its min dims.

HTH
Franz GEIGER
 
V

Ville Voipio

Couldn't you register for a handler?

Oui, mais...

I can figure out a few ugly workarounds. However, my question is if
there is a nice and clean way to make wxPython set the minimum size.
I'd really hate to start calculating the sizes myself or making
any extra handlers, if the existing infrastructure can handle what
I want.

- Ville
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top