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.

<strong>wxPython</strong> widgetshttp://www.zetcode.com/wxpython/widgets/Figure: staticbox.py#!/usr/bin/python# staticbox.pyimport wxclass StaticBox(wx.Dialog):def __init__(self, parent, id, title):wx.Dialog.__init__(self, parent, id, title, size=(250, 230))wx.StaticBox(self, -1, 'Personal Info', (5, 5), size=(240, 170))wx.CheckBox(self, -1 ,'Male', (15, 30))wx.CheckBox(self, -1 ,'Married', (15, 55))wx.StaticText(self, -1, 'Age', (15, 95))wx.SpinCtrl(self, -1, '1', (55, 90), (60, -1), min=1, max=120)wx.Button(self, 1, 'Ok', (90, 185), (60, -1))self.Bind(wx.EVT_BUTTON, self.OnClose, id=1)self.Centre()self.ShowModal()self.Destroy()def OnClose(self, event):self.Close()app = wx.App()StaticBox(None, -1, 'staticbox.py')app.MainLoop()wx.ComboBoxwx.ComboBox is a combination of a single line text field, a buttonwith a down arrow image and a listbox. When you press thebutton, a listbox appears. User can select only one option from thesupplied string list. wx.ComboBox has the following constructor:10 de 29 27/04/2008 1:04

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

Saved successfully!

Ooh no, something went wrong!