Newbie question: layout problems with wxPython

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BjornB
    New Member
    • Jun 2007
    • 6

    #1

    Newbie question: layout problems with wxPython

    Hi!

    I'm totally new to Python and I'm jus nw trying to create my first application with wxPython, exciting! However, I have a problem:

    I'm creating a Frame with a menu and buttonpanel (wx.lib.buttonp anel), then below this I want to have I splitter window, more or less like the file explorer in Windows.

    This is (some of) my code:

    [CODE=python]

    wx.Frame.__init __(self, parent, -1, title,
    style = wx.DEFAULT_FRAM E_STYLE | wx.MAXIMIZE | wx.NO_FULL_REPA INT_ON_RESIZE)


    self.MyPanel = wx.Panel(self, style = wx.MAXIMIZE )
    self.MyMenu = MyMenu(self)

    self.MyButtonPa nel = MyButtonPanel(s elf.MyPanel)

    splitter = wx.SplitterWind ow(self.MyPanel , -1, size = (3000, 2000), style = wx.SP_LIVE_UPDA TE)

    sty = wx.BORDER_SUNKE N | wx.MAXIMIZE

    p1 = wx.Window(split ter, style=sty)
    p1.SetBackgroun dColour("white" )
    wx.StaticText(p 1, -1, "Panel One", (5,5))

    p2 = wx.Window(split ter, style=sty)
    p2.SetBackgroun dColour("white" )
    wx.StaticText(p 2, -1, "Panel Two", (5,5))

    splitter.SetMin imumPaneSize(20 )
    splitter.SplitV ertically(p1, p2, 200)

    [/CODE]


    My first question is about layout, I think I have missed something important. The Frame and menu looks good, but the buttonpanel and the splitter start in the same point, just below the menu. How can I tell he splitter to start where the buttonpanel ends (in the y direcion)? I'm not sure how to layout the different objects so that it looks good, so that they will not overlap.

    The other question is about the size of the splitter, now it is (3000, 2000), just to be sure to always not be smaller than the screen. I didn't suceed to get the screen size to set that size nor did I find any attribute MAXIMIZE or similar.

    I'm running python version 2.5.

    Thanks in advance!
    Björn
    Last edited by bartonc; Jun 13 '07, 02:35 AM. Reason: Added =python to code tags
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Although I've been using wxPython for about a year now, I can't tell by looking what's going on. The reason is that I don't write the GUI part of my apps. I use a tool (referred to as a GUI generator) which lets me arrange graphical objects on the screen and forget about the details. If you are familiar with MS visual anything, you'll know what I'm talking about.

    If you are interested, I'll bet that we could find you a tool that suits your needs.

    Comment

    • BjornB
      New Member
      • Jun 2007
      • 6

      #3
      Hi!

      I'll have a look into the kind of tools that you are talking about, even tough I found the problem (I spent a lot of time reading code, uhg). What I was looking for was a sizer to have a nice layout. Then I simply added the splitter to the sizer object and it looks good.

      Thanks!
      Björn

      Comment

      Working...