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.

http://www.zetcode.com/wxpython/firststeps/Figure: A window without a minimize boxSize and PositionWe can specify the size of our application in two ways. Wehave a size parameter in the constructor of our widget. Orwe can call the SetSize() method.#!/usr/bin/python# size.pyimport wxclass Size(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(250, 200))self.Show(True)app = wx.App()Size(None, -1, 'Size')app.MainLoop()wx.Frame.__init__(self, parent, id, title, size=(250, 200))In the constructor we set the width of the wx.Frame widgetto 250px. <strong>The</strong> height of the widget to 200px.Similarly, we can position our application on the screen. Bydefault the window is placed in the upper left corner of thescreen. But it can differ on various OS platforms or evenwindow managers. Some window managers placeapplication windows themselves. Some of them do someoptimalization, so that windows do not overlap. Aprogrammer can position the window programatically. We4 de 8 27/04/2008 1:01

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

Saved successfully!

Ooh no, something went wrong!