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.

Application skeletons in <strong>wxPython</strong>http://www.zetcode.com/wxpython/skeletons/self.sizer2.Add(button6, 1, wx.EXPAND)self.sizer2.Add(button7, 1, wx.EXPAND)self.sizer2.Add(button8, 1, wx.EXPAND)self.Bind(wx.EVT_BUTTON, self.OnExit, id=ID_EXIT)self.sizer = wx.BoxSizer(wx.VERTICAL)self.sizer.Add(self.splitter,1,wx.EXPAND)self.sizer.Add(self.sizer2,0,wx.EXPAND)self.SetSizer(self.sizer)size = wx.DisplaySize()self.SetSize(size)self.sb = self.CreateStatusBar()self.sb.SetStatusText(os.getcwd())self.Center()self.Show(True)def OnExit(self,e):self.Close(True)def OnSize(self, event):size = self.GetSize()self.splitter.SetSashPosition(size.x / 2)self.sb.SetStatusText(os.getcwd())event.Skip()def OnDoubleClick(self, event):size = self.GetSize()self.splitter.SetSashPosition(size.x / 2)app = wx.App(0)FileHunter(None, -1, 'File Hunter')app.MainLoop()SpreadSheetGnumeric, KSpread and OpenOffice Calc are famous spreadsheetapplications available on Unix. <strong>The</strong> following example shows a skeletonof a spreadsheet application in <strong>wxPython</strong>.Applications have their own life. This is also true for educational scripts.After uprading to wx.Python 2.8.1.1 I realized, that the spreadsheetexample does not work. <strong>The</strong> following line was the problem.toolbar2.AddControl(wx.StaticText(toolbar2, -1, ' '))Of course, we cannot add a widget to itself. But the previous version ofthe toolkit was happy with it. Under the current version it did not work,signalizing a problem. It might or might not work on the Mac andWindows. Originally, I wanted to add some space between the comboboxes. Under the new version of the toolkit it stopped to work either soI dropped the line.4 de 11 27/04/2008 1:07

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

Saved successfully!

Ooh no, something went wrong!