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.

Advanced widgetshttp://www.zetcode.com/wxpython/advanced/Figure: Html window exampleHelp windowWe can use wx.html.HtmlWindow to provide help in our application. We cancreate a standalone window or we can create a window, that is going to be apart of the application. <strong>The</strong> following script will create a help window usingthe latter idea.#!/usr/bin/python# helpwindow.pyimport wximport wx.html as htmlclass HelpWindow(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(570, 400))toolbar = self.CreateToolBar()toolbar.AddLabelTool(1, 'Exit', wx.Bitmap('icons/exit.png'))toolbar.AddLabelTool(2, 'Help', wx.Bitmap('icons/help.png'))toolbar.Realize()self.splitter = wx.SplitterWindow(self, -1)self.panelLeft = wx.Panel(self.splitter, -1, style=wx.BORDER_SUNKEN)self.panelRight = wx.Panel(self.splitter, -1)vbox2 = wx.BoxSizer(wx.VERTICAL)header = wx.Panel(self.panelRight, -1, size=(-1, 20))header.SetBackgroundColour('#6f6a59')header.SetForegroundColour('WHITE')hbox = wx.BoxSizer(wx.HORIZONTAL)st = wx.StaticText(header, -1, 'Help', (5, 5))font = st.GetFont()font.SetPointSize(9)st.SetFont(font)hbox.Add(st, 1, wx.TOP | wx.BOTTOM | wx.LEFT, 5)close = wx.BitmapButton(header, -1, wx.Bitmap('icons/fileclose.png', wx.BITMAP_TYPE_PNG)style=wx.NO_BORDER)close.SetBackgroundColour('#6f6a59')6 de 21 27/04/2008 1:05

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

Saved successfully!

Ooh no, something went wrong!