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. Modifying Qt designer py code

Modifying Qt designer py code

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 2.6k 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.
  • G Offline
    G Offline
    gigalomaniaczero
    wrote on 29 May 2018, 10:26 last edited by
    #1

    Hello,

    I am a newbie QT designer user and I can't figure out how do I implement my own code in a qt python project. I use pyuic5 -x somefile.ui -o somefile.py to make a .py file from the ui, and that part goes well. The problem is when I edit the py file how do I add my own code?

    for example. If I have this code:

    from requests import get

    fileName =input("Enter filename: ")
    fileURL = input("URL path: ")
    with open(fileName, "wb") as f:
    response = get(fileURL)
    f.write(response.content)

    and I want to implement it in QT Designer py project, how do I do that?

    J 1 Reply Last reply 30 May 2018, 07:54
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 29 May 2018, 21:14 last edited by
      #2

      Hi and welcome to devnet,

      Qt Designer is not a code editor, so you won't write anything there.

      When would you like that code to be called ?

      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
      • G gigalomaniaczero
        29 May 2018, 10:26

        Hello,

        I am a newbie QT designer user and I can't figure out how do I implement my own code in a qt python project. I use pyuic5 -x somefile.ui -o somefile.py to make a .py file from the ui, and that part goes well. The problem is when I edit the py file how do I add my own code?

        for example. If I have this code:

        from requests import get

        fileName =input("Enter filename: ")
        fileURL = input("URL path: ")
        with open(fileName, "wb") as f:
        response = get(fileURL)
        f.write(response.content)

        and I want to implement it in QT Designer py project, how do I do that?

        J Offline
        J Offline
        JonB
        wrote on 30 May 2018, 07:54 last edited by
        #3

        @gigalomaniaczero
        In addition to what @SGaist has said, I'll throw in:

        I have a large Python code base for my project. For that benefit, I sit inside PyCharm, an excellent Python editor/debugger IDE, for all my Qt work, using PyQt5 as the harness from Qt to Python.

        For right or for wrong, I do not use Qt Creator, because it is for C++ development, not Python. I manage without "visual" design of my PyQt widgets, and create everything dynamically in Python code.

        Depending perhaps on just how much UI design you want to do, and how you feel about literal code instead of interactive design, you might want to consider this approach. I don't know how easy it is to use your puuic5 compilation principle, and how well the code it produces does or does not mesh with standalone PyQt code.

        1 Reply Last reply
        1
        • G Offline
          G Offline
          gigalomaniaczero
          wrote on 31 May 2018, 09:26 last edited by
          #4

          @JonB said in Modifying Qt designer py code:

          puuic5

          Hi,

          I know QT designer is not a code editor and I can't do any coding within the app itself. I use puuic5 to compile the ui xml code to python, but when I edit the py file, i still quite don't understand how do I add the code. I can add some simple actions like button click and few others, but any more complex code doesn't seem to work in the same python logic I used to do things.

          J 1 Reply Last reply 31 May 2018, 09:42
          0
          • G gigalomaniaczero
            31 May 2018, 09:26

            @JonB said in Modifying Qt designer py code:

            puuic5

            Hi,

            I know QT designer is not a code editor and I can't do any coding within the app itself. I use puuic5 to compile the ui xml code to python, but when I edit the py file, i still quite don't understand how do I add the code. I can add some simple actions like button click and few others, but any more complex code doesn't seem to work in the same python logic I used to do things.

            J Offline
            J Offline
            JonB
            wrote on 31 May 2018, 09:42 last edited by
            #5

            @gigalomaniaczero said in Modifying Qt designer py code:

            I can add some simple actions like button click and few others, but any more complex code doesn't seem to work in the same python logic I used to do things.

            I don't think anyone is going to know what this might mean.

            1 Reply Last reply
            0

            1/5

            29 May 2018, 10:26

            • Login

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