Languages/Python/PyKDE WebKit Tutorial/webkit3.py: Difference between revisions

From KDE TechBase
(New page: <code python> #!/usr/bin/env python import sys from PyKDE4.kdecore import * from PyKDE4.kdeui import * from PyQt4.QtCo...)
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<code python>
<syntaxhighlight lang="python">
#!/usr/bin/env python                                                                   
#!/usr/bin/env python                                                                   


Line 11: Line 11:
from PyQt4.QtWebKit import *
from PyQt4.QtWebKit import *


class Tutorial:
class Tutorial(object):
     def __init__(self):
     def __init__(self):
         self.web = QWebView()
         self.web = QWebView()
Line 37: Line 37:


sys.exit(app.exec_())
sys.exit(app.exec_())
</code>
</syntaxhighlight>

Latest revision as of 17:39, 10 March 2016

#!/usr/bin/env python                                                                   

import sys

from PyKDE4.kdecore import *
from PyKDE4.kdeui import *

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

class Tutorial(object):
    def __init__(self):
        self.web = QWebView()
        self.web.load(QUrl("http://kubuntu.org"))
        self.web.show()

appName = "python-kde-tutorial"
catalog = ""
programName = ki18n("PyKDE Tutorial")
version = "1.0"
description = ki18n("A Small Qt WebKit Example")
license = KAboutData.License_GPL
copyright = ki18n("(c) 2008 Canonical Ltd")
text = ki18n("none")
homePage = "www.kubuntu.org"
bugEmail = ""

aboutData = KAboutData (appName, catalog, programName, version, description,
license, copyright, text, homePage, bugEmail)

KCmdLineArgs.init(sys.argv, aboutData)

app = KApplication()
tutorial = Tutorial()

sys.exit(app.exec_())