Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How i import python file to qml.
Forum Updated to NodeBB v4.3 + New Features

How i import python file to qml.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 3 Posters 624 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.
  • T Offline
    T Offline
    turkey
    wrote on last edited by
    #1

    i have a python file ( this python file can speech recognition). i want to import .py file to my main.qml. i want to send text to qml file. how ?

    jsulmJ 1 Reply Last reply
    0
    • T turkey

      i have a python file ( this python file can speech recognition). i want to import .py file to my main.qml. i want to send text to qml file. how ?

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

      @turkey You can't import Python code into QML. QML is not Python
      Check https://doc.qt.io/qtforpython/tutorials/qmlapp/qmlapplication.html

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

      T 1 Reply Last reply
      2
      • jsulmJ jsulm

        @turkey You can't import Python code into QML. QML is not Python
        Check https://doc.qt.io/qtforpython/tutorials/qmlapp/qmlapplication.html

        T Offline
        T Offline
        turkey
        wrote on last edited by
        #3

        @jsulm i dont want import python code. i want to import python file. like js. for example we can add any js file as "import abcdef.js as Abcds" format like this. but im asking for .py file how ?

        KroMignonK 1 Reply Last reply
        0
        • T turkey

          @jsulm i dont want import python code. i want to import python file. like js. for example we can add any js file as "import abcdef.js as Abcds" format like this. but im asking for .py file how ?

          KroMignonK Offline
          KroMignonK Offline
          KroMignon
          wrote on last edited by
          #4

          @turkey said in How i import python file to qml.:

          i dont want import python code. i want to import python file. like js. for example we can add any js file as "import abcdef.js as Abcds" format like this. but im asking for .py file how ?

          A .js is JavaScript, so it is possible to be included in QML, which is based on JavaScript engine.
          A .py is Python code, this is not possible to import in QML

          you can NOT import any .py in QML. I don't know why you want to do it, but you have to found another way.

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

          T 1 Reply Last reply
          3
          • KroMignonK KroMignon

            @turkey said in How i import python file to qml.:

            i dont want import python code. i want to import python file. like js. for example we can add any js file as "import abcdef.js as Abcds" format like this. but im asking for .py file how ?

            A .js is JavaScript, so it is possible to be included in QML, which is based on JavaScript engine.
            A .py is Python code, this is not possible to import in QML

            you can NOT import any .py in QML. I don't know why you want to do it, but you have to found another way.

            T Offline
            T Offline
            turkey
            wrote on last edited by
            #5

            @KroMignon thank you for full of information answer. i want to do speech recognition in qml. There is no such feature directly in qml. Voice recognition can be done with python. I thought that if I could recognize voice with python and send data to qml, the problem would be solved.

            jsulmJ 1 Reply Last reply
            0
            • T turkey

              @KroMignon thank you for full of information answer. i want to do speech recognition in qml. There is no such feature directly in qml. Voice recognition can be done with python. I thought that if I could recognize voice with python and send data to qml, the problem would be solved.

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

              @turkey As already said: it is not that easy as QML and Python are two completely different things. You will need to integrate your QML and Python code (to communicate between QML and Python), see the link I posted.

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

              1 Reply Last reply
              3

              • Login

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