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.

<strong>wxPython</strong> widgetshttp://www.zetcode.com/wxpython/widgets/wx.StaticText(self, -1, 'Convert Fahrenheit temperature to Celsius', (20,20wx.StaticText(self, -1, 'Fahrenheit: ', (20, 80))wx.StaticText(self, -1, 'Celsius: ', (20, 150))self.celsius = wx.StaticText(self, -1, '', (150, 150))self.sc = wx.SpinCtrl(self, -1, '', (150, 75), (60, -1))self.sc.SetRange(-459, 1000)self.sc.SetValue(0)compute_btn = wx.Button(self, 1, 'Compute', (70, 250))compute_btn.SetFocus()clear_btn = wx.Button(self, 2, 'Close', (185, 250))wx.EVT_BUTTON(self, 1, self.OnCompute)wx.EVT_BUTTON(self, 2, self.OnClose)wx.EVT_CLOSE(self, self.OnClose)self.Centre()self.ShowModal()self.Destroy()def OnCompute(self, event):fahr = self.sc.GetValue()cels = round((fahr-32)*5/9.0, 2)self.celsius.SetLabel(str(cels))def OnClose(self, event):self.Destroy()app = wx.App()Converter(None, -1, 'Converter')app.MainLoop()wx.SplitterWindowThis widget enables to split the main area of an application intoparts. <strong>The</strong> user can dynamically resize those parts with the mousepointer. Such a solution can be seen in mail clients (evolution) orin burning software (k3b). You can split an area vertically orhorizontally.22 de 29 27/04/2008 1:04

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

Saved successfully!

Ooh no, something went wrong!