wxPython and window sizing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ville Voipio

    #1

    wxPython and window sizing

    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.SplitterWind ow(self, -1)

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

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

    s.SetMinimumPan eSize(50)
    s.SplitHorizont ally(curves, textbox)
    s.SetSashGravit y(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

    --
    Ville Voipio, Dr.Tech., M.Sc. (EE)

  • Franz GEIGER

    #2
    Re: wxPython and window sizing

    Ville Voipio wrote:
    [color=blue]
    > 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.SplitterWind ow(self, -1)
    >
    > curves = wx.Notebook(s)
    > curve = wx.Window(curve s, ID_BLANKCURVE, style=wx.SUNKEN _BORDER,
    > size=(300,200))
    > curves.AddPage( curve, "Blank")
    >
    > textbox = wx.TextCtrl(s, ID_TEXTBOX, style=wx.TE_MUL TILINE,
    > size=(-1,50))
    >
    > s.SetMinimumPan eSize(50)
    > s.SplitHorizont ally(curves, textbox)
    > s.SetSashGravit y(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
    >[/color]


    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





    Comment

    • Ville Voipio

      #3
      Re: wxPython and window sizing

      In article <dgbtmh$h2k$1@n ews.hispeed.ch> , Franz GEIGER wrote:
      [color=blue]
      > Couldn't you register for a handler?[/color]

      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

      --
      Ville Voipio, Dr.Tech., M.Sc. (EE)

      Comment

      Working...