First, make sure you have installed wxPython
Then drop this code into a file called browser.py :
import sysYou launch the browser from the command line, passing the URL to go to as argument, like so:
theApp = wx.PySimpleApp(0)
theFrame = wx.Frame(None, -1, "", size=(640,480))
w = wx.webkit.WebKitCtrl(theFrame, -1)
python_32 browser.py http://www.google.com/The last bit needed is the script python_32, which ensures python will run in 32 bit mode, because the 64 bit mode is broken unless you have installed the wxPython Cocoa libraries. Place these lines in the file 'python_32'
#!/bin/bashand place that file in the same directory as 'browser.py'. Now, also make sure that this script is executable
chmod a+x python_32Nitpickers take note. One might say that this is no different from calling a browser from the command line directly, which, according to the line counting above, would give you a browser in 0 lines of code:
open http://www.google.comHowever, I would not call that 'your own browser' in the sense that you cannot wrap your own controls around it and interact with the browser contents as you can with the script above.