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.

Application skeletons in <strong>wxPython</strong>http://www.zetcode.com/wxpython/skeletons/toolbar2.AddControl(self.position)toolbar2.AddControl(font)toolbar2.AddControl(font_height)toolbar2.AddSeparator()bold = wx.Bitmap('icons/stock_text_bold.png')toolbar2.AddCheckTool(-1, bold)italic = wx.Bitmap('icons/stock_text_italic.png')toolbar2.AddCheckTool(-1, italic)under = wx.Bitmap('icons/stock_text_underline.png')toolbar2.AddCheckTool(-1, under)toolbar2.AddSeparator()toolbar2.AddLabelTool(-1, '', wx.Bitmap('icons/text_align_left.png'))toolbar2.AddLabelTool(-1, '', wx.Bitmap('icons/text_align_center.png'))toolbar2.AddLabelTool(-1, '', wx.Bitmap('icons/text_align_right.png'))box.Add(toolbar1, border=5)box.Add((5,5) , 0)box.Add(toolbar2)box.Add((5,10) , 0)toolbar2.Realize()self.SetSizer(box)notebook = wx.Notebook(self, -1, style=wx.RIGHT)sheet1 = MySheet(notebook)sheet2 = MySheet(notebook)sheet3 = MySheet(notebook)sheet1.SetFocus()notebook.AddPage(sheet1, 'Sheet1')notebook.AddPage(sheet2, 'Sheet2')notebook.AddPage(sheet3, 'Sheet3')box.Add(notebook, 1, wx.EXPAND)self.CreateStatusBar()self.Centre()self.Show(True)app = wx.App()Newt(None, -1, 'SpreadSheet')app.MainLoop()Much of the code builds the menus and toolbars. Besides, it is quite asimple example.class MySheet(sheet.CSheet):def __init__(self, parent):sheet.CSheet.__init__(self, parent)self.row = self.col = 0self.SetNumberRows(55)self.SetNumberCols(25)for i in range(55):self.SetRowSize(i, 20)<strong>The</strong> MySheet class inherits from the CSheet class, which is located in7 de 11 27/04/2008 1:07

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

Saved successfully!

Ooh no, something went wrong!