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. Developing Python applications in Qt Creator
Forum Update on Monday, May 27th 2025

Developing Python applications in Qt Creator

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 2.1k 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.
  • S Offline
    S Offline
    Shilvz Sam
    wrote on 13 Jan 2016, 05:40 last edited by
    #1

    I haven't been able to figure out how to create a Qt application in Python with it so far. Online documentation about it appears to be scarce.How do I set up such a project in Qt Creator? Ideally I'm looking for a simple "Hello World" project that I can open in Qt Creator and use that as a starting point to build something.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      David.G
      wrote on 13 Jan 2016, 06:09 last edited by
      #2

      Welcome to DevNet,

      As far as my knowledge goes you can't use python with QtCreator. However, you can use other powerful IDEs like PyCharm or powerful text editors like emacs or vim. (In this example I'm using vim)

      Programming Qt4 ( or Qt5) with Python feels basically the same as if you were writing it in C++, as in you can use Qt's documentation and tutorials. The exception being the language and the way you organize your app.

      My example doesn't show much but should give you an idea. If you use linux, do install the following packages.

      sudo apt-get install python-qt4 python-qt4-dev (I use Qt4 in this out of laziness)

      The code I use

      from PyQt4 import QtGui
      import sys
      # you can also write it as 
      # from PyQt4.QtGui import QLabel
      app = QtGui.QApplication(sys.argv)
      
      window = QtGui.QMainWindow()
      window.setWindowTitle("Qt Rocks!")
      window.setFixedWidth(500)
      window.setFixedHeight(500)
      
      widget = QtGui.QWidget()
      
      label = QtGui.QLabel("Hello world",window)
      layout = QtGui.QVBoxLayout()
      layout.addWidget(label)
      
      widget.setLayout(layout)
      window.setCentralWidget(widget)
      
      window.show()
      sys.exit(app.exec_())
      

      Screenshot added

      I use vim with several plugins, my recommendation is to use PyCharm instead (mileage may vary)

      I hope this helps you, happy coding.

      http://pyqt.sourceforge.net/Docs/PyQt4/introduction.html

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Shilvz Sam
        wrote on 13 Jan 2016, 06:38 last edited by
        #3

        Thank You :) But what about using pycharm in Rasberry pi

        1 Reply Last reply
        0
        • D Offline
          D Offline
          David.G
          wrote on 13 Jan 2016, 12:08 last edited by
          #4

          Since we are talking about python scripts you can simply write a script that:

          • Pushes your scripts through SCP (SSH)
          • or Use Git to pull new changes

          You can just use your desktop/laptop and leave deployment/testing later on the Raspberry Pi as you don't need to write code using the device. In theory your code should run anywhere if Python and PyQt4/Qt4 supports it.

          So wrapping it up, don't use your Rasberry pi to develop, use your desktop/laptop, it should be fine.

          1 Reply Last reply
          0

          1/4

          13 Jan 2016, 05:40

          • Login

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