Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. IPC between Python backend to a QML GUI
Forum Updated to NodeBB v4.3 + New Features

IPC between Python backend to a QML GUI

Scheduled Pinned Locked Moved Solved Qt for Python
13 Posts 3 Posters 1.7k Views 1 Watching
  • 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
    mertb
    wrote on last edited by
    #3

    Hi, I use swipeview and drawer from QTQuickControls 2 which was not available on those. Is there a work around to use these directly on python?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      What exact issue did you got ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mertb
        wrote on last edited by
        #5

        On the Application window, the value that was passed from the python is not shown. Instead I see only "..." maybe something else is writing after that but cannot read it exactly. The qml part cannot load the python variable is what I am guessing but I could not manage to get it working

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          Something is not clear: are you writing your application in Python ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mertb
            wrote on last edited by
            #7

            No. I created the app from QT creator using QML. On the GUI that uses the qt quick controls, I have a text box. The content of the text box should be updated with a new value, and the value should come from a seperate python script. On python I create the needed data and keep them as string variables. On QML, I need to access the value of those python strings to update the value with them. For example,
            It says "Temperature: BLABLA" on the GUI, and the temperature data is stored in a seperate python script. How can I simply reach those values that are on the python and present them on qml GUI?

            jsulmJ 1 Reply Last reply
            0
            • M mertb

              No. I created the app from QT creator using QML. On the GUI that uses the qt quick controls, I have a text box. The content of the text box should be updated with a new value, and the value should come from a seperate python script. On python I create the needed data and keep them as string variables. On QML, I need to access the value of those python strings to update the value with them. For example,
              It says "Temperature: BLABLA" on the GUI, and the temperature data is stored in a seperate python script. How can I simply reach those values that are on the python and present them on qml GUI?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @mertb See here: https://doc.qt.io/qt-5/ipc.html
              You can't do IPC with QML as far as I know, so you will need to write also C++ code which communicates with the Python process over IPC and provides the data to QML (https://doc.qt.io/qt-5/qtqml-cppintegration-topic.html).

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #9

                @mertb said in IPC between Python backend to a QML GUI:

                the temperature data is stored in a seperate python script.

                This concept is not clear. Do you mean your Python scripts is responsible for reading the temperature from some device ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mertb
                  wrote on last edited by
                  #10

                  Yes, the python code gets the temperature from a device.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    In that case why not use something like MQTT to publish the device data ?
                    On the Qt side use the QtMqtt module to subscribe to it.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mertb
                      wrote on last edited by
                      #12

                      Thanks for your replies and interest.
                      MQTT Sounds like a very nice and robust solution, but my project requires using a wired usb connection that can be very easily handled by a library on python. Therefore, I need to keep using python and usb connection. jsulm's advice on using C++ turned out be really easy to implement, so I will probaby do so. I am planning to make python script and C++ that connects via an IPC method. For now I can send out static messages from C++ to my GUI following some tutorials on QT's Youtube.

                      Thanks and have a good day!

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        If you have now everything in C++, why do you even need IPC ? You can do everything within the same application.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        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