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. Oddball configuration: and Can PySide6 Bluetooth Classic and BLE be run in a separate python thread?
Forum Updated to NodeBB v4.3 + New Features

Oddball configuration: and Can PySide6 Bluetooth Classic and BLE be run in a separate python thread?

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 437 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.
  • R Offline
    R Offline
    Ravenboy
    wrote on last edited by
    #1

    using python 3.13 on an M3 matchbook pro, but not using the version that has the experimental threading model.

    I am using the Bluestuff objects only, running in the context of a wxpython app
    I have
    os.environ['QT_EVENT_DISPATCHER_CORE_FOUNDATION'] = '1'

    I am only using QT for it's bluetooth, since Python STILL lacks bluetooth support , and the app has many threads but the QT bluetooth objects are all running in the same thread as the application (the 'main' thread, where all the wxpythoin guy objects are running)

    so my question is:
    are there 'gotchas' about running the QT bluetooth in a thread that is NOT the application's thread

    specifically: do I have to do anything other than
    os.environ['QT_EVENT_DISPATCHER_CORE_FOUNDATION'] = '1'

    jsulmJ 1 Reply Last reply
    0
    • R Ravenboy

      using python 3.13 on an M3 matchbook pro, but not using the version that has the experimental threading model.

      I am using the Bluestuff objects only, running in the context of a wxpython app
      I have
      os.environ['QT_EVENT_DISPATCHER_CORE_FOUNDATION'] = '1'

      I am only using QT for it's bluetooth, since Python STILL lacks bluetooth support , and the app has many threads but the QT bluetooth objects are all running in the same thread as the application (the 'main' thread, where all the wxpythoin guy objects are running)

      so my question is:
      are there 'gotchas' about running the QT bluetooth in a thread that is NOT the application's thread

      specifically: do I have to do anything other than
      os.environ['QT_EVENT_DISPATCHER_CORE_FOUNDATION'] = '1'

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

      @Ravenboy said in Oddball configuration: and Can PySide6 Bluetooth Classic and BLE be run in a separate python thread?:

      are there 'gotchas' about running the QT bluetooth in a thread that is NOT the application's thread

      Should work. But you most probably will need Qt event loop.

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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Ravenboy
        wrote on last edited by
        #3

        thanks, I'll give it a try
        as it is now, the service gets registered fine, but when I start a service discovery
        I get
        serviceInfo.registerService(localAdapter.address()): True
        2024-10-31 11:40:55.383 Python[9728:593469] -[IOBluetoothDeviceInquiry initWithDelegate:] - 0x6000032d2a60
        QObject::startTimer: Timers can only be used with threads started with QThread

        this is because so far the QT objects are all running in the wxpyton app thread

        t sounds like I have to start a qThread, and that thread needs to have a QCoreApplication object running.

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

          Hi,

          It looks like you are creating objects in the main thread and then move them to the other thread hence the error message you get.

          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
          • R Offline
            R Offline
            Ravenboy
            wrote on last edited by Ravenboy
            #5

            I didn't post anything about receiving error messages in this thread.
            when I posted in this thread I hadn't tried doing anything about having another thread yet.

            I HAVE since tried it and the Mac OSX won't allow running QT applications in other than the main thread, whether the main thread is a wxpython app thread, OR if the main thread is a QT application main thread.

            I am just about to give up. I am locked in to over a million lines of wxpython code, and switching my apps to QT is not going to happen because of the size of my legacy code base

            thanks for the help

            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