PyQt5 FULL Modern Gui Tutorial #2 - Login Form: GUI & Database [for beginners]

Поделиться
HTML-код
  • Опубликовано: 30 янв 2025

Комментарии • 70

  • @theexposer9483
    @theexposer9483 Год назад +2

    Very complicated and steep learning curve for PYQT. The effort of Hala is great. Thank you.

  • @rohitkumarshaw8383
    @rohitkumarshaw8383 3 года назад +13

    Timestamps for reference -
    00:30 - Objective
    2:07 - SQLite database
    2:52 - login username password validation demonstration
    4:00 - Null input validation demonstration
    4:32 - Creating Welcome screen in Qt Designer
    4:40 - Login screen in Qt Designer
    8:29 - Transparent Line Edit box
    9:52 - press login event (Welcome screen)
    11:21 - Calling login UI
    13:17 - Go to login screen when Login button is pressed
    15:40 - Hide password using *****
    16:52 - Event to press login
    19:12 - label for error message if wrong password
    20:38 - if username and password is empty display error
    22:00 - retrieving password from stored database, using SQLite
    24:41 - check if entered username and password matches with stored ones
    26:29 - How to clear error message if successfully logged in
    26:45 - Recap
    27:34 - Aim of next video (create account)

  • @hannabouttros172
    @hannabouttros172 2 года назад +1

    DEAR HALA, I ALREADY DID THE FIRST TWO TUTORIALS OF THIS SERIES AND UPON CORRECTING MY MISTAKES AND WATCHING A COUPLE OF OTHERS THAT YOU POSTED IN YOUR WONDERFUL SERIES OF TUTORAILS ON PYQT5, EVERYTHING IS NOW WORKING PERFECTLY WELL. I CAN NOT THANK YOU ENOUGH FOR ALL YOUR HARD WORK AND EXPLANATIONS. I AM LOOKING FORWARD TO THE LAS VIDEO OF THIS 3 PART SERIES AND I HAVE LEARNT A LOT FROM YOU! AGAIN, MY PROFUSE THANKS FOR ALL YOUR WORK!

  • @SHONNER
    @SHONNER Год назад

    Thank you for this. I have been playing around with the code, converting the UI files to PY files and importing them without UIC. SQLite crashes when I try to create a login that already exists. But that's no big deal. I'll add a conditional for that. Thanks again.

  • @abhijeetgaonkar449
    @abhijeetgaonkar449 3 года назад +5

    Nice explanation 💯🔥
    One correction: you have not checked if the username exists in the database or not, so if you enter wrong username the application closes without giving any error message

  • @Mr_Moe_Lesterr
    @Mr_Moe_Lesterr 3 года назад +1

    Does it matter if we choose MainWindow or Widget instead of QDialog when we create a new file in QT Designer?

  • @kuahara
    @kuahara 2 года назад +5

    A few people are inquiring about validation on the username. Here is how I resolved that in the sample code from this video:
    Note that my db name and some of my object names might be different.
    def loginfunction(self):
    user = self.usernamefield.text()
    password = self.passwordfield.text()
    if len(user) == 0 or len(password) == 0:
    self.outputlabel.setText("Please fill out all fields")
    else:
    conn = sqlite3.connect("userdb.db")
    cur = conn.cursor()
    query = 'SELECT COUNT(*) FROM users WHERE username = \''+user+"\'"
    cur.execute(query)
    result_usercount = cur.fetchone()[0]
    if result_usercount > 0:
    query = 'SELECT password FROM users WHERE username = \''+user+"\'"
    cur.execute(query)
    result_pass = cur.fetchone()[0]
    if result_pass == password:
    print("Successfully logged in")
    self.outputlabel.setText("")
    else:
    self.outputlabel.setText("Invalid username or password")
    else:
    self.outputlabel.setText("Invalid username or password")

    • @TP-mv6en
      @TP-mv6en 2 года назад

      when I run this, nothing happens; it just closes. Do you have any idea why?

    • @TP-mv6en
      @TP-mv6en 2 года назад

      I have changed all object names appropriately

    • @GeneSokolov
      @GeneSokolov 2 года назад

      @@TP-mv6en The code works, your indent is probably wrong. Make sure you copy it exactly as written.

    • @endermun
      @endermun 7 месяцев назад

      Thanks

  • @Css-Designes
    @Css-Designes Год назад

    In line 16,addWidget i am getting error that argument 1 has unexpected type 'sip.wrappertype'. How to solve it?

  • @softwareprogrammingdatasci1807

    please 🙏 how can I find the part 4 of this tutorial, where you created the fill profile module?
    thanks 🙏 for the nice teaching

  • @Induraj11
    @Induraj11 Год назад

    but on maximizing window, the login screen is not scaling up. why?

  • @smxk3y755
    @smxk3y755 3 года назад +1

    if wrong password is typed it does what it supposed BUT if wrong username was typed it crashed and comes with error message
    main.py", line 38, in loginfunction
    result_pass = cur.fetchone()[0]
    TypeError: 'NoneType' object is not subscriptable

  • @ahmaddalain7994
    @ahmaddalain7994 3 года назад +1

    Absolutely splendid content and explanation. Please keep it up, thank you

  • @adityanugroho2945
    @adityanugroho2945 3 года назад +1

    why i get name 'widget' is not defined? please help

  • @dzihanseptiangraini7804
    @dzihanseptiangraini7804 2 года назад

    i already do like in the video but when input username and password correctly the label still error. help!!!!🤔

  • @mikoystories6435
    @mikoystories6435 3 года назад

    Been waiting for this, thank you very much. keep educating us.....

  • @_Boni_
    @_Boni_ 3 года назад +8

    Be aware if you want to make a real login system. You need to have some sort of encryption to keep the passwords safe! (I meant for the viewers :D)

    • @TP-mv6en
      @TP-mv6en 2 года назад +1

      how would you go about doing that?

    • @gagankarnati643
      @gagankarnati643 2 года назад +1

      how do u do dat

    • @mahiraskari
      @mahiraskari 5 месяцев назад

      @@gagankarnati643 bro might be cooked, asking for help with everything 💀

  • @Midnight-mi3ie
    @Midnight-mi3ie Год назад

    "TypeError: 'NoneType' object is not subscriptable" why do I get something like this?

  • @siyabongahlongwana2386
    @siyabongahlongwana2386 9 месяцев назад

    Great expanation ,I am getting stuck when setting up password on login screen after clicking the login button I get an error C:\Users\Gorefield\Documents\Software Dev\Sales\main.py:19: DeprecationWarning: sipPyTypeDict() is deprecated, the extension module should use sipPyTypeDictRef() instead
    class LoginScreen(QDialog):

  • @tekturk2167
    @tekturk2167 3 года назад

    what is the rgba code of the background color of the window?

  • @TheWolf1340
    @TheWolf1340 Год назад

    Hello. Nice content! But I have a problem: if i put a wrong user name I get a message : result_pass = cur.fetchone()[0]
    TypeError: 'NoneType' object is not subscriptable

  • @rabiahussain4953
    @rabiahussain4953 3 года назад

    how to Change QPushButton icon when pressing the same button (toggle) in qt designer?

  • @userjdufer466
    @userjdufer466 3 года назад

    The only thing that makes this GUI modern is the nice gradient!

  • @damienlee9619
    @damienlee9619 3 года назад +1

    Thank you for the video. When I am running this I get a error saying "Name Error: name 'widget' is not defined from "gotologin", when I click the login button from the welcomeScreen. Can you help me how this can be resolved? And also when I run it without that part, the program opens but closes immediately. Could you also help me with this?

  • @TP-mv6en
    @TP-mv6en 2 года назад

    when i run the code after the validation, it just closes and doesn't print out "logged in successfully" even if it is the correct username and password. Do you have any idea what could be wrong?

    • @gagankarnati643
      @gagankarnati643 2 года назад

      did u fix this?

    • @TP-mv6en
      @TP-mv6en 2 года назад

      @@gagankarnati643 nah but I'll try again and I'll let you know if I'm successful

  • @hessmess9504
    @hessmess9504 3 года назад

    Very practical and very useful tutorial. Thank you for the efforts and for the sharing

  • @perlasaadeh3322
    @perlasaadeh3322 3 года назад

    Great explanation! Thank you for sharing

  • @jueha3468
    @jueha3468 3 года назад

    My god, your voice is so lovely. And nice tutorial ofc!

  • @felipedelamata
    @felipedelamata 3 года назад +1

    Hi there !!!
    if you put an user that doesnt exist in DB, it returns a NONETYPE error. How to fix it? thx a lot ! =)

    • @ahmaddalain7994
      @ahmaddalain7994 3 года назад

      same happend, i think some line should check whether username does exist or not first, as if username does not exist the [0] index cannot go with null type items as per error

    • @kareng4120
      @kareng4120 3 года назад

      Did you fix it

    • @abdelhakimasri6146
      @abdelhakimasri6146 3 года назад

      hey, did you solve your problem ? i solve mine by adding some lines of codes using try except:
      try:
      for row in rows:
      if passwordtext==row :
      self.cams = MyApp()
      self.cams.show()
      self.close()

      else:
      self.checking.setText('Invalid Usernamed or Password')
      except:
      self.checking.setText('Invalid Usernamed or Password')

    • @abdelhakimasri6146
      @abdelhakimasri6146 3 года назад

      @@ahmaddalain7994 see my comment below

    • @abdelhakimasri6146
      @abdelhakimasri6146 3 года назад

      @@kareng4120 see my comment below

  • @irshadwahab
    @irshadwahab 2 года назад

    Hi, I am getting the following error when i try to attach the login.ui page : "AttributeError: 'WelcomeScreen' object has no attribute 'login'". Any idea why?

  • @lucasvignera6539
    @lucasvignera6539 3 года назад

    thanks for the tutorial, I have a question, how do you create the table login_info in the db inside the code?

  • @ДастанАлымбеков-ю5и

    Thanks for really excellent tutorial, you are the best

  • @mouaadrio5883
    @mouaadrio5883 3 года назад

    thanks for the video. excellent stuff

  • @gojosenpai9461
    @gojosenpai9461 3 года назад

    thanks for the good content keep it going

  • @govinej
    @govinej 3 года назад

    Great video

  • @prakashkombala
    @prakashkombala 3 года назад

    Very Good Thanks lot

  • @jalilkdidir
    @jalilkdidir 3 года назад

    very good

  • @matheuslemos8013
    @matheuslemos8013 3 года назад

    Is someone having the problem, when the password doesn't with the database, the code stop working?

    • @ivantito2119
      @ivantito2119 3 года назад

      I had the same problem, when the username and pass is the same, all ok, but when it's not, application stop working, and shows me an message like: result_pass = cur.fetchone()[0] TypeError: 'NoneType' object is not subscriptable

    • @TP-mv6en
      @TP-mv6en 2 года назад

      yeah i had the same provlem

    • @TP-mv6en
      @TP-mv6en 2 года назад

      @@ivantito2119 you could probably just use result_pass[0] for the if statement and then remove [0] from cur.fetchone()[0] maybe

  • @knowledgetreasure-1523
    @knowledgetreasure-1523 Год назад

    u shud be a teacher you have an academic way of explaining

  • @littricks3631
    @littricks3631 3 года назад

    I just can't resist but are you that same TikTok girl who complains about her teacher while on zoom class but gets caught cause she forgot to turn off the mic!?Please tell me you are that girl cause it's literally the same voice!🤣

    • @codefirstwithhala
      @codefirstwithhala  3 года назад

      Sorry, not me! 😬 Do share if you find it though, i’m curious haha

  • @zakihasan8042
    @zakihasan8042 3 года назад +1

    I don't know if it is apropriate to say that, but I'm gonna say it anyway. To me her sound is music, she is very fluent and oh my God this subtle Arabic accent drives me crazy.
    if it too much, I apologize in advance.
    Nevertheless, she presents very useful tutorials that any programmer could benifit.

  • @AlbertoBezerraProf
    @AlbertoBezerraProf 2 года назад

    🎉

  • @jeromemarbebe3791
    @jeromemarbebe3791 3 года назад

    thankyou

  • @thebrindian939
    @thebrindian939 2 года назад

    LENG STYL (the voice)

  • @salehhassan367
    @salehhassan367 2 года назад

    أعجبني.

  • @БогданСтариков-н3ь
    @БогданСтариков-н3ь 2 года назад

    beautiful girl, thanks for your videos!!! Greetings from Russia