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/self.Bind(wx.EVT_BUTTON, self.OnClose, id=1)self.Bind(wx.EVT_COMBOBOX, self.OnSelect)self.Centre()self.ShowModal()self.Destroy()def OnClose(self, event):self.Close()def OnSelect(self, event):item = event.GetSelection()self.picture.SetFocus()self.picture.SetBitmap(wx.Bitmap('images/' + self.images[item]))app = wx.App()ComboBox(None, -1, 'combobox.py')app.MainLoop()wx.CheckBoxwx.CheckBox is a widget that has two states. On and Off. It is abox with a label. <strong>The</strong> label can be set to the right or to the left ofthe box. If the checkbox is checked, it is represented by a tick in abox. wx.CheckBox Styleswx.ALIGN_RIGHTFigure: checkbox.py#!/usr/bin/python# checkbox.pyimport wxclass CheckBox(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(250, 170))panel = wx.Panel(self, -1)12 de 29 27/04/2008 1:04

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

Saved successfully!

Ooh no, something went wrong!