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. PyQT4 App
Qt 6.11 is out! See what's new in the release blog

PyQT4 App

Scheduled Pinned Locked Moved Unsolved Qt for Python
42 Posts 4 Posters 56.8k 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.
  • JonBJ JonB

    @Mitko
    I stated that the example I quoted seems already to be in PyQt5. I have no idea what it does, as I don't speak Russian.

    The github code you quoted is in PyQt4. Personally I would rather update that to PyQt5 than try to install and get PyQt4 working. Up to you.

    M Offline
    M Offline
    Mitko
    wrote on last edited by
    #5

    @JonB
    Ok, if i can't use PyQt4, how can i convert this part of the project (that use PyQt4 ) to PyQt5 ?
    The project should establish zigbee topology, but i can't test it

    JonBJ 1 Reply Last reply
    0
    • M Mitko

      @JonB
      Ok, if i can't use PyQt4, how can i convert this part of the project (that use PyQt4 ) to PyQt5 ?
      The project should establish zigbee topology, but i can't test it

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #6

      @Mitko
      I don't know if you mean by "part of the project" that you think you can have a project containing some PyQt5/Qt5 stuff and some PyQt4/Qt4 together in one app. If you do think that, you can't. So you have a couple of choices:

      • Continue your original route of trying to get PyQt4/Qt4 installed and running, using the various resources you were trying for PyQt4/Qt4, so that you can use xbee-gui as-is. I just think that's rather hard, and not good going forward if you intend to do further development, but I never did that so I don't know.

      • Change xbee-gui code to move to PyQt5/Qt5. I used https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5 and perhpas https://stackoverflow.com/questions/46554746/pyqt4-to-pyqt5-how for that.

      • Find some already-ported version of xbee-gui or ask the original developer. But I don't know that you will get much joy that way.

      As you please.

      M 1 Reply Last reply
      0
      • JonBJ JonB

        @Mitko
        I don't know if you mean by "part of the project" that you think you can have a project containing some PyQt5/Qt5 stuff and some PyQt4/Qt4 together in one app. If you do think that, you can't. So you have a couple of choices:

        • Continue your original route of trying to get PyQt4/Qt4 installed and running, using the various resources you were trying for PyQt4/Qt4, so that you can use xbee-gui as-is. I just think that's rather hard, and not good going forward if you intend to do further development, but I never did that so I don't know.

        • Change xbee-gui code to move to PyQt5/Qt5. I used https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5 and perhpas https://stackoverflow.com/questions/46554746/pyqt4-to-pyqt5-how for that.

        • Find some already-ported version of xbee-gui or ask the original developer. But I don't know that you will get much joy that way.

        As you please.

        M Offline
        M Offline
        Mitko
        wrote on last edited by
        #7

        @JonB

        I try to upgrade from PyQT4 to 5, but now i have other types of errors, that i don't understand.
        Can someone help me ?
        254295116_440010580821929_772944740554573543_n.jpg

        JonBJ 1 Reply Last reply
        0
        • M Mitko

          @JonB

          I try to upgrade from PyQT4 to 5, but now i have other types of errors, that i don't understand.
          Can someone help me ?
          254295116_440010580821929_772944740554573543_n.jpg

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #8

          @Mitko
          I don't think this is actually anything to do with PyQt, or Qt. If you had copied and pasted the text instead of screenshot I could have quoted from it. But I see a Python3.8 json library loader complaining about some character in its JSON input.

          M 1 Reply Last reply
          0
          • JonBJ JonB

            @Mitko
            I don't think this is actually anything to do with PyQt, or Qt. If you had copied and pasted the text instead of screenshot I could have quoted from it. But I see a Python3.8 json library loader complaining about some character in its JSON input.

            M Offline
            M Offline
            Mitko
            wrote on last edited by
            #9

            @JonB

            The error was, because part one of the files (the json), containing the xbee commands, has Russian in it, so the problem was with UTF-8 encoding, but i fix it.
            But now i have the following problem:

            File "C:/xbee-gui-master/MainForm.py", line 18, in <module>
                class Block(QtGui.QMainWindow, QtGui.QTreeView):
            NameError: name 'QtGui' is not defined
            

            How to solve it ?

            JonBJ 1 Reply Last reply
            0
            • M Mitko

              @JonB

              The error was, because part one of the files (the json), containing the xbee commands, has Russian in it, so the problem was with UTF-8 encoding, but i fix it.
              But now i have the following problem:

              File "C:/xbee-gui-master/MainForm.py", line 18, in <module>
                  class Block(QtGui.QMainWindow, QtGui.QTreeView):
              NameError: name 'QtGui' is not defined
              

              How to solve it ?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #10

              @Mitko
              Qt5 moved widget code from QtGui to QtWidgets, change to that. You will have to do the same for any other widget stuff. I gave you reference to https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5 for this --- it's the very first item there --- and told you that's what I used to do the porting work.

              M 1 Reply Last reply
              1
              • JonBJ JonB

                @Mitko
                Qt5 moved widget code from QtGui to QtWidgets, change to that. You will have to do the same for any other widget stuff. I gave you reference to https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5 for this --- it's the very first item there --- and told you that's what I used to do the porting work.

                M Offline
                M Offline
                Mitko
                wrote on last edited by
                #11

                @JonB
                I began to solve this problem, but now i have this error:

                 C:\xbee-gui-master\PyQT\Scripts\python.exe C:/xbee-gui-master/MainForm.py
                Traceback (most recent call last):
                  File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                    main()
                  File "C:/xbee-gui-master/MainForm.py", line 355, in main
                    bl = Block()
                  File "C:/xbee-gui-master/MainForm.py", line 26, in __init__
                    self.setWindowIcon(QtWidgets.QIcon("zigbee.png"))
                AttributeError: module 'PyQt5.QtWidgets' has no attribute 'QIcon'
                
                jsulmJ 1 Reply Last reply
                0
                • M Mitko

                  @JonB
                  I began to solve this problem, but now i have this error:

                   C:\xbee-gui-master\PyQT\Scripts\python.exe C:/xbee-gui-master/MainForm.py
                  Traceback (most recent call last):
                    File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                      main()
                    File "C:/xbee-gui-master/MainForm.py", line 355, in main
                      bl = Block()
                    File "C:/xbee-gui-master/MainForm.py", line 26, in __init__
                      self.setWindowIcon(QtWidgets.QIcon("zigbee.png"))
                  AttributeError: module 'PyQt5.QtWidgets' has no attribute 'QIcon'
                  
                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #12

                  @Mitko said in PyQT4 App:

                  QIcon

                  This one is in gui module.
                  I guess in PyQt it is PyQt5.QtGui

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

                  M 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Mitko said in PyQT4 App:

                    QIcon

                    This one is in gui module.
                    I guess in PyQt it is PyQt5.QtGui

                    M Offline
                    M Offline
                    Mitko
                    wrote on last edited by
                    #13

                    @jsulm

                    I change it, but now i have this:

                     C:\xbee-gui-master\PyQT\Scripts\python.exe C:/xbee-gui-master/MainForm.py
                    Traceback (most recent call last):
                      File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                        main()
                      File "C:/xbee-gui-master/MainForm.py", line 355, in main
                        bl = Block()
                      File "C:/xbee-gui-master/MainForm.py", line 26, in __init__
                        self.setWindowIcon(QtWidgets.QGui("zigbee.png"))
                    AttributeError: module 'PyQt5.QtWidgets' has no attribute 'QGui'
                    
                    jsulmJ 1 Reply Last reply
                    0
                    • M Mitko

                      @jsulm

                      I change it, but now i have this:

                       C:\xbee-gui-master\PyQT\Scripts\python.exe C:/xbee-gui-master/MainForm.py
                      Traceback (most recent call last):
                        File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                          main()
                        File "C:/xbee-gui-master/MainForm.py", line 355, in main
                          bl = Block()
                        File "C:/xbee-gui-master/MainForm.py", line 26, in __init__
                          self.setWindowIcon(QtWidgets.QGui("zigbee.png"))
                      AttributeError: module 'PyQt5.QtWidgets' has no attribute 'QGui'
                      
                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #14

                      @Mitko said in PyQT4 App:

                      PyQt5.QtWidgets' has no attribute 'QGui'

                      I did not suggest to write QtWidgets.QGui but PyQt5.QtGui

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

                      M 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @Mitko said in PyQT4 App:

                        PyQt5.QtWidgets' has no attribute 'QGui'

                        I did not suggest to write QtWidgets.QGui but PyQt5.QtGui

                        M Offline
                        M Offline
                        Mitko
                        wrote on last edited by
                        #15

                        @jsulm

                         C:\xbee-gui-master\PyQT\Scripts\python.exe C:/xbee-gui-master/MainForm.py
                        Traceback (most recent call last):
                          File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                            main()
                          File "C:/xbee-gui-master/MainForm.py", line 355, in main
                            bl = Block()
                          File "C:/xbee-gui-master/MainForm.py", line 26, in __init__
                            self.setWindowIcon(PyQt5.QGui("zigbee.png"))
                        NameError: name 'PyQt5' is not defined 
                        
                        jsulmJ 1 Reply Last reply
                        0
                        • M Mitko

                          @jsulm

                           C:\xbee-gui-master\PyQT\Scripts\python.exe C:/xbee-gui-master/MainForm.py
                          Traceback (most recent call last):
                            File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                              main()
                            File "C:/xbee-gui-master/MainForm.py", line 355, in main
                              bl = Block()
                            File "C:/xbee-gui-master/MainForm.py", line 26, in __init__
                              self.setWindowIcon(PyQt5.QGui("zigbee.png"))
                          NameError: name 'PyQt5' is not defined 
                          
                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #16

                          @Mitko said in PyQT4 App:

                          PyQt5.QGui("zigbee.png")

                          What is this?! You want to use QIcon, right?
                          It should be I guess

                          QtGui.QIcon("zigbee.png")
                          

                          It is also shown in the documentation which you should consult: https://doc.qt.io/qtforpython-5/PySide2/QtGui/QIcon.html

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

                          M 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @Mitko said in PyQT4 App:

                            PyQt5.QGui("zigbee.png")

                            What is this?! You want to use QIcon, right?
                            It should be I guess

                            QtGui.QIcon("zigbee.png")
                            

                            It is also shown in the documentation which you should consult: https://doc.qt.io/qtforpython-5/PySide2/QtGui/QIcon.html

                            M Offline
                            M Offline
                            Mitko
                            wrote on last edited by
                            #17

                            @jsulm

                             C:\xbee-gui-master\PyQT\Scripts\python.exe C:/xbee-gui-master/MainForm.py
                            Traceback (most recent call last):
                              File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                                main()
                              File "C:/xbee-gui-master/MainForm.py", line 355, in main
                                bl = Block()
                              File "C:/xbee-gui-master/MainForm.py", line 26, in __init__
                                self.setWindowIcon(QtGui.QIcon("zigbee.png"))
                            NameError: name 'QtGui' is not defined 
                            
                            jsulmJ 1 Reply Last reply
                            0
                            • M Mitko

                              @jsulm

                               C:\xbee-gui-master\PyQT\Scripts\python.exe C:/xbee-gui-master/MainForm.py
                              Traceback (most recent call last):
                                File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                                  main()
                                File "C:/xbee-gui-master/MainForm.py", line 355, in main
                                  bl = Block()
                                File "C:/xbee-gui-master/MainForm.py", line 26, in __init__
                                  self.setWindowIcon(QtGui.QIcon("zigbee.png"))
                              NameError: name 'QtGui' is not defined 
                              
                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #18

                              @Mitko said in PyQT4 App:

                              name 'QtGui' is not defined

                              You of course have to import this module like any other module

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

                              M 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @Mitko said in PyQT4 App:

                                name 'QtGui' is not defined

                                You of course have to import this module like any other module

                                M Offline
                                M Offline
                                Mitko
                                wrote on last edited by
                                #19

                                @jsulm
                                Via Interpreter ? I've try, it seems to installed, but i've got same error

                                jsulmJ 1 Reply Last reply
                                0
                                • M Mitko

                                  @jsulm
                                  Via Interpreter ? I've try, it seems to installed, but i've got same error

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

                                  @Mitko said in PyQT4 App:

                                  Via Interpreter ?

                                  Don't know what you mean.

                                  from PyQt5 import QtGui
                                  

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

                                  M 1 Reply Last reply
                                  0
                                  • jsulmJ jsulm

                                    @Mitko said in PyQT4 App:

                                    Via Interpreter ?

                                    Don't know what you mean.

                                    from PyQt5 import QtGui
                                    
                                    M Offline
                                    M Offline
                                    Mitko
                                    wrote on last edited by
                                    #21

                                    @jsulm
                                    Thank you, i fix this

                                    But now i have this:

                                     Traceback (most recent call last):
                                      File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                                        main()
                                      File "C:/xbee-gui-master/MainForm.py", line 355, in main
                                        bl = Block()
                                      File "C:/xbee-gui-master/MainForm.py", line 28, in __init__
                                        self.centralWidgetLayout = QtGui.QVBoxLayout(self.centralWidget)
                                    AttributeError: module 'PyQt5.QtGui' has no attribute 'QVBoxLayout'
                                    
                                    
                                    jsulmJ 1 Reply Last reply
                                    0
                                    • M Mitko

                                      @jsulm
                                      Thank you, i fix this

                                      But now i have this:

                                       Traceback (most recent call last):
                                        File "C:/xbee-gui-master/MainForm.py", line 360, in <module>
                                          main()
                                        File "C:/xbee-gui-master/MainForm.py", line 355, in main
                                          bl = Block()
                                        File "C:/xbee-gui-master/MainForm.py", line 28, in __init__
                                          self.centralWidgetLayout = QtGui.QVBoxLayout(self.centralWidget)
                                      AttributeError: module 'PyQt5.QtGui' has no attribute 'QVBoxLayout'
                                      
                                      
                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #22

                                      @Mitko said in PyQT4 App:

                                      QVBoxLayout

                                      Please do also some research on your own!
                                      If you google for QVBoxLayout you will find https://doc.qt.io/qt-5/qvboxlayout.html and there it is clearly stated that it is in widgets module (qmake: QT += widgets).

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

                                      M 2 Replies Last reply
                                      1
                                      • jsulmJ jsulm

                                        @Mitko said in PyQT4 App:

                                        QVBoxLayout

                                        Please do also some research on your own!
                                        If you google for QVBoxLayout you will find https://doc.qt.io/qt-5/qvboxlayout.html and there it is clearly stated that it is in widgets module (qmake: QT += widgets).

                                        M Offline
                                        M Offline
                                        Mitko
                                        wrote on last edited by
                                        #23

                                        @jsulm
                                        I'm new and don't understand everything

                                        1 Reply Last reply
                                        0
                                        • jsulmJ jsulm

                                          @Mitko said in PyQT4 App:

                                          QVBoxLayout

                                          Please do also some research on your own!
                                          If you google for QVBoxLayout you will find https://doc.qt.io/qt-5/qvboxlayout.html and there it is clearly stated that it is in widgets module (qmake: QT += widgets).

                                          M Offline
                                          M Offline
                                          Mitko
                                          wrote on last edited by
                                          #24

                                          @jsulm

                                          I've try this but i have same error

                                          from PyQt5.QtWidgets import (QApplication, QWidget, QVBoxLayout, QHBoxLayout,
                                                                       QPushButton, QLabel, QLineEdit, QTabBar,
                                                                       QFrame, QStackedLayout)
                                          
                                          JonBJ 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