At this tutorial we create own web browser, using Python. We also will be using PyQt library. To start we need to install next packages.
If python-kde4 don't want to install, then update your repository. If you write code under Ubuntu or Debian then use this link.
Locate and open the qt4-designer. Select "Main Window" and click "Create". And now we have interface window, what will be our graphics interface. Drag component KWebView on our window. If in your list will be only QtWebView component then select him. Also add componet - Line Edit the upper area of the window. Click File > Save As > browser.ui. Run command.
This command was generates Python file. Remove from kwebview import KWebView line from the bottom of browser.py file. Change
Create
If your code does not run, use the following code (or check and find differences): browser.py
Creating graphics interface with PyQt
Locate and open the qt4-designer. Select "Main Window" and click "Create". And now we have interface window, what will be our graphics interface. Drag component KWebView on our window. If in your list will be only QtWebView component then select him. Also add componet - Line Edit the upper area of the window. Click File > Save As > browser.ui. Run command.
KWebView
on QtWebView. We will be using QtWebView
instead KWebView. Creating logic
Create
run.py
file with the following contents:
This code uses a graphical interface described in the file browser.py and adds logic to it. Lines:
First line describe action. If user click enter (returnPressed), this call loadURL function. That means that in any case, when you press enter page load according to the above functions. if you all make correct, then browser must to run with next command. Please ensure that you use the full url: http://talkera.org including the prefix http: //. Your browser must activate .
If your code does not run, use the following code (or check and find differences): browser.py
run.py