Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Getting data from runJavaScript()
Forum Updated to NodeBB v4.3 + New Features

Getting data from runJavaScript()

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MHaqui
    wrote on last edited by
    #1

    Hello,
    I'm using a QWebEngine.page().runJavaScript() to read a js string in order to display a js into a mainWindow and a plugin. I need to access to the js variable in my python script to show data. How can i access to the js variable ?
    For example i would like to get the stage variable in this script : da81794e-5297-4c6d-91b9-45730986e6c3-image.png

    JonBJ 1 Reply Last reply
    0
    • M MHaqui

      Hello,
      I'm using a QWebEngine.page().runJavaScript() to read a js string in order to display a js into a mainWindow and a plugin. I need to access to the js variable in my python script to show data. How can i access to the js variable ?
      For example i would like to get the stage variable in this script : da81794e-5297-4c6d-91b9-45730986e6c3-image.png

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @MHaqui
      Hello and welcome.

      For the future please paste code, not a screenshot, as it helps people answer questions.

      To retrieve data from JS script have a look at the techniques in QtWebEngine - synchronously execute JavaScript to read function result. Basically they are using a QVariant as an argument to a lambda call passed to runJavaScript().

      You'll have to figure how to for Python. For one thing it may depend on whether you are PyQt or PySide which you don't say. See also https://forum.qt.io/topic/100303/qtwebenginepage-runjavascript. And the complicated https://stackoverflow.com/questions/61473152/how-to-get-return-value-from-pyqts-qwebenginepage-runjavascript.

      @eyllanesc may know the current state of play with Python/PyQt/PySide....

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved