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. PyQt fails on MacOS (Apple silicon)
Forum Updated to NodeBB v4.3 + New Features

PyQt fails on MacOS (Apple silicon)

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 938 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.
  • D Offline
    D Offline
    daryllee
    wrote on last edited by
    #1

    I finally decided to give PyQt a chance to replace Tkinter today, but it's not going well. I'm on a MacBook Air with M2 chip, MacOS 14.4.1, Python 3.12. I did "pip install pyqt5" and "pip install pyqt5-tools"and then tried the program below. It ran with no error messages but did not produce a window. So I upgraded to PyQt6, but the pip install pyqt-toolsgot stuck on these few lines of output:

    Collecting pyqt6-tools
      Downloading pyqt6_tools-6.1.0.3.2-py3-none-any.whl.metadata (8.3 kB)
    Collecting pyqt6==6.1.0 (from pyqt6-tools)
      Downloading PyQt6-6.1.0.tar.gz (946 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 946.9/946.9 kB 4.9 MB/s eta 0:00:00
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Preparing metadata (pyproject.toml) ... -
    

    Ctl-C did no good. I had to open another terminal session totry my program and got the same result: no errors, no window. Any suggestions?

    My starter program.

    from PyQt5 import QtWidgets
    from PyQt5.QtWidgets import QApplication, QMainWindow
    import sys
    
    def window():
        xpos = 200
        ypos = 200
        width = 300
        height = 300
    
        app = QApplication(sys.argv)
        win = QMainWindow()
        win.setGeometry(xpos, ypos, width, height)
        win.setWindowTitle("Tech with Tim")
    
    
        # Contents
    
    
        win.show()
        sys.exit(app.exit())
    
    if __name__ == "__main__":
        window()
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi

      It's app.exec() that you should use. Your call to app.exit() stops the application before it can start.

      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
      1

      • Login

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