Results 1 to 5 of 5

Thread: How to build apps using PyQt?

  1. #1
    Join Date
    Sep 2012
    Beans
    8

    Lightbulb How to build apps using PyQt?

    Hi there!
    In the beginning this topic was designed like "what am I doing wrong?" issue, but now I would like to ask you to make sure that all I'm doing is correct.
    The issue is that in Wikipedia article I found the words "PyQt4 contains the following Python modules. <..> The QtDesigner module contains classes that allow Qt Designer to be extended using PyQt.", but QT Designer only allows to create forms using QT libraries, not PyQt. QT Creator also doesn't allow to write apps using PyQT. I've been trying to figure out how to connect PyQt with QT Cteator, and that's the result of my thoughts:

    1. Create form in QT Designer using original QT classes.
    2. Save file as filename.ui
    3. Open terminal and change directory to the one containing filename.ui
    4. Execute pyuic4 filename.ui > mainform.ui
    5. In our main programm file type import mainform.ui and create instance of our class, for example:



    So, am I right? Perhaps there is an easier and more native way to create applications using PyQt?
    Last edited by spinderworka; March 22nd, 2013 at 12:04 PM. Reason: Solved

  2. #2
    Join Date
    Jun 2008
    Location
    Tennessee
    Beans
    3,421

    Re: How to build apps using PyQt?

    That's pretty much the process as I understand it; I think if you use Eric there are some tools to automate this process, but I don't care for Eric as an IDE. Any more I just hand-code my forms (or write something to build them from a config), since I don't do anything terribly complex.

    Remind me, does pyuic output python code? You might need to redirect it to "mainform.py" to import it.

  3. #3
    Join Date
    Sep 2012
    Beans
    8

    Re: How to build apps using PyQt?

    Quote Originally Posted by lykwydchykyn View Post
    You might need to redirect it to "mainform.py" to import it.
    As I understand, for python no matter what file types I import.

    I found this example on wikipedia, and it works well for me

  4. #4
    Join Date
    Jul 2006
    Location
    UK
    Beans
    192
    Distro
    Ubuntu 15.04 Vivid Vervet

    Re: How to build apps using PyQt?

    PyQt can be treated as any other Python module, so you can just code with it directly.

    I personally don't use QtCreator/Designer at all. I much prefer to code the GUI elements by hand, as this gives me a lot more understanding and control over what's going on. It also seems more natural to me.
    Registered Linux User #426227

  5. #5
    Join Date
    Jun 2009
    Location
    Chicago Suburbs
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to build apps using PyQt?

    I typically have 3 tasks running, I open geany, terminal, & Qt designer.

    Then I edit screens in Qt designer, save, & in terminal I have a script that is just the pyuic4 command for this projects ui file & make sure permissions are set with chmod. Then I can run it in geany and see if my changes worked the way I thought.
    For info on UEFI boot install & repair - Updated Mar 2015:
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to close thread when/if answered completely.







Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •