Community
VRED Forum
Welcome to Autodesk’s VRED Forums. Share your knowledge, ask questions, and explore popular VRED topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PySide2.QtWebKit not available ?!

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
9757 Views, 5 Replies

PySide2.QtWebKit not available ?!

Enter this code "from PySide2.QtWebKit import QWebView" to VRED 2018.3 (10.11) terminal the result is: 

 

root: from PySide2.QtWebKit import QWebView

Traceback (most recent call last):

File "<string>", line 1, in <module>

ImportError: No module named QtWebKit

 

Does that mean pyside2 is  limited and can't deal with QWebView (i.e. to emulate a browser) ??

 

 

5 REPLIES 5
Message 2 of 6
michael_nikelsky
in reply to: Anonymous

QtWebkit is deprecated and therefore no longer supported. You should use QWebEngine instead: http://doc.qt.io/qt-5/qtwebenginewidgets-qtwebkitportingguide.html

 

Kind regards

Michael



Michael Nikelsky
Sr. Principal Engineer
Message 3 of 6
Anonymous
in reply to: michael_nikelsky

Hmm??

 

I'm not sure what you mean with: use QWebEngineView?!

 

In fact this doesn'r work either:

 

root: from PySide2.QWebEngine import *

Traceback (most recent call last):

File "<string>", line 1, in <module>

ImportError: No module named QWebEngine

Message 4 of 6
michael_nikelsky
in reply to: Anonymous

Hi,

 

it should be

from PySide2.QtWebEngineWidgets import QWebEngineView

 

For example:

 

from PySide2.QtWebEngineWidgets import QWebEngineView
from PySide2.QtCore import QUrl


view = QWebEngineView()
view.load(QUrl("https://wiki.qt.io/PySide2"))
view.show()

 

Kind regards

Michael



Michael Nikelsky
Sr. Principal Engineer
Message 5 of 6
Anonymous
in reply to: michael_nikelsky

That's a big progress !!!

 

But I have still some strange problem:

 

This code works fine:

 

# -*- coding: utf-8 -*-
import sys

try: # Version 2018+
   from PySide2.QtWebEngineWidgets import QWebEngineView
   from PySide2.QtCore import QUrl
except ImportError:
   print "Uuups, can't import all needed stuff"

 

if __name__ == '__main__':
   view = QWebEngineView()
   view.load(QUrl("https://wiki.qt.io/PySide2"))
   view.show()

 

 

But the folowing code doesn't show anything !!! ????

 

 

# -*- coding: utf-8 -*-
import sys

try: # Version 2018+
   from PySide2.QtWebEngineWidgets import QWebEngineView
   from PySide2.QtCore import QUrl
except ImportError:
   print "Uuups, can't import all needed stuff"

def run():
   view = QWebEngineView()
   view.load(QUrl("https://wiki.qt.io/PySide2"))
   view.show()

if __name__ == '__main__':
   run()

 

So question: What's wrong with that???

Message 6 of 6
sinje_thiedemann
in reply to: Anonymous

The view object you create in run() goes out of scope at the end of run, so the widget is deleted again and you don't see it.

 

Move the code from run() into a class:

 

# -*- coding: utf-8 -*-
import sys

try: # Version 2018+
   from PySide2.QtWebEngineWidgets import QWebEngineView
   from PySide2.QtCore import QUrl
except ImportError:
   print "Uuups, can't import all needed stuff"

class View:
    def __init__(self):
       self.view = QWebEngineView()
       self.view.load(QUrl("https://wiki.qt.io/PySide2"))
       self.view.show()

if __name__ == '__main__':
   view = View()

Kind regards

Sinje

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report