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. Use python module in qt console application
Forum Updated to NodeBB v4.3 + New Features

Use python module in qt console application

Scheduled Pinned Locked Moved Unsolved General and Desktop
pythonqt5.6psutil
4 Posts 2 Posters 1.8k 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.
  • iNdicat0rI Offline
    iNdicat0rI Offline
    iNdicat0r
    wrote on last edited by
    #1

    Hi
    I was looking for a cross-platform process utility module in qt but didn't find anything useful. After a bit of research I came across a python module called psutil located at psutil
    Now my question is if its possible to use this module inside my qt application and get back the results from this python module.

    Most of my code is in c++ so i just need to get those values from python and feed them into my functions. One important issue is the dependency of the application on python which means user needs to install python before the qt application can be run... I want to totally avoid the idea of forcing the user to install python as prerequisite.

    Comments are welcome.

    K 1 Reply Last reply
    0
    • iNdicat0rI iNdicat0r

      Hi
      I was looking for a cross-platform process utility module in qt but didn't find anything useful. After a bit of research I came across a python module called psutil located at psutil
      Now my question is if its possible to use this module inside my qt application and get back the results from this python module.

      Most of my code is in c++ so i just need to get those values from python and feed them into my functions. One important issue is the dependency of the application on python which means user needs to install python before the qt application can be run... I want to totally avoid the idea of forcing the user to install python as prerequisite.

      Comments are welcome.

      K Offline
      K Offline
      KeithS
      wrote on last edited by
      #2

      @iNdicat0r

      It's possible if you embed Python into your Qt C++ code. See https://docs.python.org/2/extending/embedding.html for example. Then if you want to call your own C/C++ functions from within Python you can use SWIG to do this.

      iNdicat0rI 1 Reply Last reply
      0
      • K KeithS

        @iNdicat0r

        It's possible if you embed Python into your Qt C++ code. See https://docs.python.org/2/extending/embedding.html for example. Then if you want to call your own C/C++ functions from within Python you can use SWIG to do this.

        iNdicat0rI Offline
        iNdicat0rI Offline
        iNdicat0r
        wrote on last edited by
        #3

        @KeithS

        Ok so user should have python preinstalled in order to run my qt c++ application? I want to avoid this..

        K 1 Reply Last reply
        0
        • iNdicat0rI iNdicat0r

          @KeithS

          Ok so user should have python preinstalled in order to run my qt c++ application? I want to avoid this..

          K Offline
          K Offline
          KeithS
          wrote on last edited by
          #4

          @iNdicat0r

          In theory not if your app is built with the python lib and shipped with the dll/shared lib. Of course if any python code requires other python modules or libs then you might need to ship these too and set up your PYTHONPATH env var appropriately.

          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