13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Layout management in <strong>wxPython</strong>http://www.zetcode.com/wxpython/layout/#!/usr/bin/python# absolute.pyimport wxclass Absolute(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(250, 180))panel = wx.Panel(self, -1)menubar = wx.MenuBar()file = wx.Menu()edit = wx.Menu()help = wx.Menu()menubar.Append(file, '&File')menubar.Append(edit, '&Edit')menubar.Append(help, '&Help')self.SetMenuBar(menubar)wx.TextCtrl(panel, -1, pos=(-1, -1), size=(250, 150))self.Centre()self.Show(True)app = wx.App(0)Absolute(None, -1, '')app.MainLoop()wx.TextCtrl(panel, -1, pos=(-1, -1), size=(250, 150))We do the absolute positioning in the constructor of the wx.TextCtrl. In our case, weprovide the default position for the widget. <strong>The</strong> width is 250px and the height 150px.Using sizersSizers do address all those issues, we mentioned by absolute positioning. We canchoose among these sizers.wx.BoxSizerwx.StaticBoxSizerwx.GridSizerwx.FlexGridSizerwx.GridBagSizer2 de 17 27/04/2008 1:03

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

Saved successfully!

Ooh no, something went wrong!