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> dialogshttp://www.zetcode.com/wxpython/dialogs/AddDeveloper(stringdeveloper)AddDocWriter(stringdocwirter)AddArtist(string artist)AddTranslator(stringdeveloper)add a developer to thedeveloper's listadd a docwriter to the docwriter'slistadd an artist to the artist's listadd a developer to the translator'slist<strong>The</strong> constructor of the wx.AboutBox is as follows. It takes awx.AboutDialogInfo as a parameter.wx.AboutBox(wx.AboutDialogInfo info)<strong>wxPython</strong> can display two kinds of About boxes. It depends on whichplatform we use and which methods we call. It can be a native dialogor a <strong>wxPython</strong> generic dialog. Windows native about dialog boxcannot display custom icons, licence text nor the url's. If we omitthese three fields, wx.Python will show a native dialog. Otherwise itwill resort to a generic one. It is advised to provide licenceinformation in a separate menu item, if we want to stay as native aspossible. GTK+ can show all these fields.#!/usr/bin/python# aboutbox.pyimport wxID_ABOUT = 1class AboutDialogBox(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(260, 200))menubar = wx.MenuBar()help = wx.Menu()help.Append(ID_ABOUT, '&About')self.Bind(wx.EVT_MENU, self.OnAboutBox, id=ID_ABOUT)menubar.Append(help, '&Help')self.SetMenuBar(menubar)self.Centre()self.Show(True)def OnAboutBox(self, event):description = """File Hunter is an advanced file manager for the Unix operatingsystem. Features include powerful built-in editor, advanced search capabilities,powerful batch renaming, file comparison, extensive archive handling and more."""licence = """File Hunter is free software; you can redistribute it and/or modif6 de 11 27/04/2008 1:04

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

Saved successfully!

Ooh no, something went wrong!