13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Layout management in <strong>wxPython</strong>http://www.zetcode.com/wxpython/layout/Home ContentsPython IDEFaster, Easier Python Development Editor,Debugger, Browser, and moreGarment Size MarkersMini Markers, Sizers, Size Clips. Manufacturerwith worldwide sales.Layout management in <strong>wxPython</strong>A typical application consists of various widgets. Those widgets are placed insidecontainer widgets. A programmer must manage the layout of the application. This isnot an easy task. In <strong>wxPython</strong> we have two options.absolute positioningsizersAbsolute Positioning<strong>The</strong> programmer specifies the position and the size of each widget in pixels. Whenyou use absolute positioning, you have to understand several things.the size and the position of a widget do not change, if you resize a windowapplications look different (crappy) on various platformschanging fonts in your application might spoil the layoutif you decide to change your layout, you must completely redo your layout,which is tedious and time consuming<strong>The</strong>re might be situations, where we can possibly use absolute positioning. Forexample, my <strong>tutorial</strong>s. I do not want to make the examples too difficult, so I oftenuse absolute positioning to explain a topic. But mostly, in real world programs,programmers use sizers.In our example we have a simple skeleton of a text editor. If we resize the window,the size of out wx.TextCtrl does not change as we would expect.Figure: before resizementFigure: after resizement1 de 17 27/04/2008 1:03

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!