Welcome folks today in this blog post we will be making web browser using html window class
in gui desktop app in python. All the full source code of the application is given below.
Get Started
In order to get started you need to install the below library using the pip
command as shown below
pip install wxpython
After installing this library you need to make an app.py
file and copy paste the following code
app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import wx import wx.html class MyHtmlFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, size = (600,400)) html = wx.html.HtmlWindow(self) if "gtk2" in wx.PlatformInfo: html.SetStandardFonts() dlg = wx.TextEntryDialog(self, 'Enter a URL', 'HTMLWindow') if dlg.ShowModal() == wx.ID_OK: html.LoadPage(dlg.GetValue()) app = wx.App() frm = MyHtmlFrame(None, "Simple HTML Browser") frm.Show() app.MainLoop() |
If you execute the above python script
by typing the below command
python app.py