| 1 | |
| 2 | import wx |
| 3 | from wx.lib.wordwrap import wordwrap |
| 4 | |
| 5 | #---------------------------------------------------------------------- |
| 6 | |
| 7 | class TestPanel(wx.Panel): |
| 8 | def __init__(self, parent, log): |
| 9 | self.log = log |
| 10 | wx.Panel.__init__(self, parent, -1) |
| 11 | |
| 12 | b = wx.Button(self, -1, "Show a wx.AboutBox", (50,50)) |
| 13 | self.Bind(wx.EVT_BUTTON, self.OnButton, b) |
| 14 | |
| 15 | |
| 16 | def OnButton(self, evt): |
| 17 | # First we create and fill the info object |
| 18 | info = wx.AboutDialogInfo() |
| 19 | info.Name = "Hello World" |
| 20 | info.Version = "1.2.3" |
| 21 | info.Copyright = "(C) 2006 Programmers and Coders Everywhere" |
| 22 | info.Description = wordwrap( |
| 23 | "A \"hello world\" program is a software program that prints out " |
| 24 | "\"Hello world!\" on a display device. It is used in many introductory " |
| 25 | "tutorials for teaching a programming language." |
| 26 | |
| 27 | "\n\nSuch a program is typically one of the simplest programs possible " |
| 28 | "in a computer language. A \"hello world\" program can be a useful " |
| 29 | "sanity test to make sure that a language's compiler, development " |
| 30 | "environment, and run-time environment are correctly installed.", |
| 31 | 350, wx.ClientDC(self)) |
| 32 | info.WebSite = ("http://en.wikipedia.org/wiki/Hello_world", "Hello World home page") |
| 33 | info.Developers = [ "Joe Programmer", |
| 34 | "Jane Coder", |
| 35 | "Vippy the Mascot" ] |
| 36 | |
| 37 | info.License = wordwrap(licenseText, 500, wx.ClientDC(self)) |
| 38 | |
| 39 | # Then we call wx.AboutBox giving it that info object |
| 40 | wx.AboutBox(info) |
| 41 | |
| 42 | |
| 43 | #---------------------------------------------------------------------- |
| 44 | |
| 45 | def runTest(frame, nb, log): |
| 46 | win = TestPanel(nb, log) |
| 47 | return win |
| 48 | |
| 49 | #---------------------------------------------------------------------- |
| 50 | |
| 51 | |
| 52 | |
| 53 | overview = """<html><body> |
| 54 | <h2><center>wx.AboutBox</center></h2> |
| 55 | |
| 56 | This function shows the native standard about dialog containing the |
| 57 | information specified in info. If the current platform has a native |
| 58 | about dialog which is capable of showing all the fields in info, the |
| 59 | native dialog is used, otherwise the function falls back to the |
| 60 | generic wxWidgets version of the dialog. |
| 61 | |
| 62 | </body></html> |
| 63 | """ |
| 64 | |
| 65 | |
| 66 | licenseText = "blah " * 250 + "\n\n" +"yadda " * 100 |
| 67 | |
| 68 | |
| 69 | if __name__ == '__main__': |
| 70 | import sys,os |
| 71 | import run |
| 72 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) |
| 73 | |