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. QPushButton exit my application when clicked
Forum Updated to NodeBB v4.3 + New Features

QPushButton exit my application when clicked

Scheduled Pinned Locked Moved Unsolved Qt for Python
12 Posts 3 Posters 1.6k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #3

    Hi and welcome to devnet,

    Which buttons triggers that ?

    By the way, please use coding tags around your code (the </> button) so it makes it easier to read.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    L 1 Reply Last reply
    0
    • JonBJ JonB

      @LT-K101
      Run it in a debugger and see where it crashes/how far you get. Or put print() statements in.

      L Offline
      L Offline
      LT-K101
      wrote on last edited by
      #4

      @JonB I used pycharm community edition to run the program and i get no error message just that the application exits when i click on a refresh button to load data from sqlite3 database

      JonBJ 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Which buttons triggers that ?

        By the way, please use coding tags around your code (the </> button) so it makes it easier to read.

        L Offline
        L Offline
        LT-K101
        wrote on last edited by
        #5

        @SGaist when i write a function for a button to either insert data into sqlite3 DB or load data from sqlite3 DB.

        1 Reply Last reply
        0
        • L LT-K101

          @JonB I used pycharm community edition to run the program and i get no error message just that the application exits when i click on a refresh button to load data from sqlite3 database

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

          @LT-K101
          Did you step through in the debugger to watch which statements get executed and where it crashes? Or at least put in print() statements?

          L 1 Reply Last reply
          0
          • JonBJ JonB

            @LT-K101
            Did you step through in the debugger to watch which statements get executed and where it crashes? Or at least put in print() statements?

            L Offline
            L Offline
            LT-K101
            wrote on last edited by
            #7

            @JonB I did insert the print () statement and it did work perfectly. I think its the database connection.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              Out of curiosity, why not use Qt's SQL module ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              L 1 Reply Last reply
              0
              • SGaistS SGaist

                Out of curiosity, why not use Qt's SQL module ?

                L Offline
                L Offline
                LT-K101
                wrote on last edited by
                #9

                @SGaist I have not tried Qtsql but I'm familiar with sqlite3.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  Then as asked before: which exact method makes your application crash ?

                  Which exception do you get ?

                  Did you try to use pdb to see what is going on ?

                  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
                  0
                  • L Offline
                    L Offline
                    LT-K101
                    wrote on last edited by
                    #11

                    @SGaist now i can run and display my application but the syntax for connecting to the db within the PyQT5 GUI class is my problem now.

                    JonBJ 1 Reply Last reply
                    0
                    • L LT-K101

                      @SGaist now i can run and display my application but the syntax for connecting to the db within the PyQT5 GUI class is my problem now.

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

                      @LT-K101
                      PyQt5 does not come with its own Python documentation for Qt methods. They expect you to look at the standard C++ docs and adapt to Python. PySide does give some documentation, and should be same for PyQt5. So you should read through e.g. https://doc.qt.io/qtforpython-5/PySide2/QtSql/QSqlDatabase.html#detailed-description where there are Python examples of using QSqlDatabase, etc.

                      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