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. How to hide a window and show another window

How to hide a window and show another window

Scheduled Pinned Locked Moved Solved Qt for Python
16 Posts 3 Posters 1.4k 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.
  • L Offline
    L Offline
    LT-K101
    wrote on last edited by
    #1

    Hi,
    I'm having this error after creating an account for a user with a default password. After the default password is set a new window pops up asking the user to set new password and a confirm the password entered. After user enters a new password and confirms it. I want the loign page to show but I'm having this error message

    from Login import LoginWindow
    ImportError: cannot import name 'LoginWindow' from partially initialized module 'Login' (most likely due to a circular import)
    Below is what I tried after importing the login screen.

    from PyQt5 import QtCore, QtGui, QtWidgets
    from mainmenu import MainWindow
    from credentials import login_credentials
    import sqlite3
    from Login import LoginWindow
    
    
    
     self.hide()
     loginwindow=LoginWindow()
     loginwindow.show()
    
    JonBJ L 2 Replies Last reply
    0
    • L LT-K101

      Hi,
      I'm having this error after creating an account for a user with a default password. After the default password is set a new window pops up asking the user to set new password and a confirm the password entered. After user enters a new password and confirms it. I want the loign page to show but I'm having this error message

      from Login import LoginWindow
      ImportError: cannot import name 'LoginWindow' from partially initialized module 'Login' (most likely due to a circular import)
      Below is what I tried after importing the login screen.

      from PyQt5 import QtCore, QtGui, QtWidgets
      from mainmenu import MainWindow
      from credentials import login_credentials
      import sqlite3
      from Login import LoginWindow
      
      
      
       self.hide()
       loginwindow=LoginWindow()
       loginwindow.show()
      
      L Offline
      L Offline
      LT-K101
      wrote on last edited by
      #4

      @JonB I did the following and it solved the error.

       import Login 
      
       self.hide()
       loginwindow=Login.LoginWindow()
       loginwindow.show()
      
      JonBJ 1 Reply Last reply
      0
      • L LT-K101

        Hi,
        I'm having this error after creating an account for a user with a default password. After the default password is set a new window pops up asking the user to set new password and a confirm the password entered. After user enters a new password and confirms it. I want the loign page to show but I'm having this error message

        from Login import LoginWindow
        ImportError: cannot import name 'LoginWindow' from partially initialized module 'Login' (most likely due to a circular import)
        Below is what I tried after importing the login screen.

        from PyQt5 import QtCore, QtGui, QtWidgets
        from mainmenu import MainWindow
        from credentials import login_credentials
        import sqlite3
        from Login import LoginWindow
        
        
        
         self.hide()
         loginwindow=LoginWindow()
         loginwindow.show()
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #2

        @LT-K101
        Is this really your file? It is not a legal Python module as shown.
        And what file is this saved as? Login.py??

        L 2 Replies Last reply
        0
        • JonBJ JonB

          @LT-K101
          Is this really your file? It is not a legal Python module as shown.
          And what file is this saved as? Login.py??

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

          @JonB Thats the login page file. I have a login page with username and password which is saved as Login.py and a newlogin.py which have new password and confirm password.

          1 Reply Last reply
          0
          • L LT-K101

            Hi,
            I'm having this error after creating an account for a user with a default password. After the default password is set a new window pops up asking the user to set new password and a confirm the password entered. After user enters a new password and confirms it. I want the loign page to show but I'm having this error message

            from Login import LoginWindow
            ImportError: cannot import name 'LoginWindow' from partially initialized module 'Login' (most likely due to a circular import)
            Below is what I tried after importing the login screen.

            from PyQt5 import QtCore, QtGui, QtWidgets
            from mainmenu import MainWindow
            from credentials import login_credentials
            import sqlite3
            from Login import LoginWindow
            
            
            
             self.hide()
             loginwindow=LoginWindow()
             loginwindow.show()
            
            L Offline
            L Offline
            LT-K101
            wrote on last edited by
            #4

            @JonB I did the following and it solved the error.

             import Login 
            
             self.hide()
             loginwindow=Login.LoginWindow()
             loginwindow.show()
            
            JonBJ 1 Reply Last reply
            0
            • JonBJ JonB

              @LT-K101
              Is this really your file? It is not a legal Python module as shown.
              And what file is this saved as? Login.py??

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

              @JonB Thanks for the response

              1 Reply Last reply
              0
              • L LT-K101

                @JonB I did the following and it solved the error.

                 import Login 
                
                 self.hide()
                 loginwindow=Login.LoginWindow()
                 loginwindow.show()
                
                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #6

                @LT-K101
                OK now that you have sorted the import statement.

                So you have a Python file with a top-level statement

                 self.hide()
                

                as you show, nothing else in the file other than you show, and this work as Python code? Could you explain how that works, please, I am intrigued/wish to learn?

                L 1 Reply Last reply
                0
                • JonBJ JonB

                  @LT-K101
                  OK now that you have sorted the import statement.

                  So you have a Python file with a top-level statement

                   self.hide()
                  

                  as you show, nothing else in the file other than you show, and this work as Python code? Could you explain how that works, please, I am intrigued/wish to learn?

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

                  @JonB There is an sql query which after execution it hides the current window and show the login window

                  cur.execute(''' UPDATE users SET user_password ='" + encrytpass + "',access_status='existing' WHERE id_no ='"+username2+"' ''')
                  con.commit()
                  QMessageBox.information(self, "Success", "Password Saved Successfully")
                  self.hide()
                  self.loginwindow = Login.LoginWindow()
                  self.loginwindow.show()
                  
                  JonBJ 1 Reply Last reply
                  0
                  • L LT-K101

                    @JonB There is an sql query which after execution it hides the current window and show the login window

                    cur.execute(''' UPDATE users SET user_password ='" + encrytpass + "',access_status='existing' WHERE id_no ='"+username2+"' ''')
                    con.commit()
                    QMessageBox.information(self, "Success", "Password Saved Successfully")
                    self.hide()
                    self.loginwindow = Login.LoginWindow()
                    self.loginwindow.show()
                    
                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #8

                    @LT-K101 So what you showed was not the whole file at all, now I understand.

                    L 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @LT-K101 So what you showed was not the whole file at all, now I understand.

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

                      @JonB Sorry my bad. Is it possible to encrypt sql database before I make a .exe?

                      JonBJ SGaistS 2 Replies Last reply
                      0
                      • L LT-K101

                        @JonB Sorry my bad. Is it possible to encrypt sql database before I make a .exe?

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

                        @LT-K101 said in How to hide a window and show another window:

                        Is it possible to encrypt sql database before I make a .exe?

                        No idea what this means. Please try to give enough detail in a question to allow us to understand :)

                        L 1 Reply Last reply
                        0
                        • L LT-K101

                          @JonB Sorry my bad. Is it possible to encrypt sql database before I make a .exe?

                          SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #11

                          @LT-K101 said in How to hide a window and show another window:

                          @JonB Sorry my bad. Is it possible to encrypt sql database before I make a .exe?

                          Hi,

                          How would you decrypt and use it afterwards ?

                          In any case, since you are not using Qt's SQL module, you should check pysqlcipher3,

                          On a side note, the way you are building your queries opens for SQL injection attacks.

                          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
                          1
                          • SGaistS SGaist

                            @LT-K101 said in How to hide a window and show another window:

                            @JonB Sorry my bad. Is it possible to encrypt sql database before I make a .exe?

                            Hi,

                            How would you decrypt and use it afterwards ?

                            In any case, since you are not using Qt's SQL module, you should check pysqlcipher3,

                            On a side note, the way you are building your queries opens for SQL injection attacks.

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

                            @SGaist What is the best practice for building sql queries, I thought what I'm doing is the standard way of doing things. Please can you enlighten me more on this please. Thank you.

                            JonBJ 1 Reply Last reply
                            0
                            • JonBJ JonB

                              @LT-K101 said in How to hide a window and show another window:

                              Is it possible to encrypt sql database before I make a .exe?

                              No idea what this means. Please try to give enough detail in a question to allow us to understand :)

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

                              @JonB What I mean is how to protect my database file on a computer's C:// drive ?Because I don't want the database file to be tempered with by an authorized persons.

                              JonBJ 1 Reply Last reply
                              0
                              • L LT-K101

                                @SGaist What is the best practice for building sql queries, I thought what I'm doing is the standard way of doing things. Please can you enlighten me more on this please. Thank you.

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

                                @LT-K101 said in How to hide a window and show another window:

                                What is the best practice for building sql queries, I thought what I'm doing is the standard way of doing things. Please can you enlighten me more on this please. Thank you.

                                You are choosing to use Python library instead of Qt library for all your SQL access, so this is not a Qt question. Look up "SQL injection attack" for your Python SQL library, it perhaps will explain and tell you to use "bound variables" in your queries rather than your attempt to interpolate arbitrary string variables into your string.

                                1 Reply Last reply
                                1
                                • L LT-K101

                                  @JonB What I mean is how to protect my database file on a computer's C:// drive ?Because I don't want the database file to be tempered with by an authorized persons.

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

                                  @LT-K101 said in How to hide a window and show another window:

                                  @JonB What I mean is how to protect my database file on a computer's C:// drive ?Because I don't want the database file to be tempered with by an authorized persons.

                                  More or less, you cannot. You may be able to restrict who can connect via SQLite to it (e.g. by not divulging password), but (unless you take some network file protection measures under NTFS, unlikely) you cannot stop a local user from deleting/altering a file on C:.

                                  1 Reply Last reply
                                  1
                                  • L Offline
                                    L Offline
                                    LT-K101
                                    wrote on last edited by
                                    #16

                                    @JonB Thanks a lot I really appreciate your help.

                                    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