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

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ธ.ค. 2024

ความคิดเห็น • 70

  • @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)

  • @theexposer9483
    @theexposer9483 ปีที่แล้ว +2

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

  • @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!

  • @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 6 หลายเดือนก่อน

      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?

  • @abhijeetgaonkar449
    @abhijeetgaonkar449 2 ปีที่แล้ว +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

  • @_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 ปีที่แล้ว +1

      how do u do dat

    • @mahiraskari
      @mahiraskari 3 หลายเดือนก่อน

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

  • @ahmaddalain7994
    @ahmaddalain7994 3 ปีที่แล้ว +1

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

  • @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

  • @Induraj11
    @Induraj11 ปีที่แล้ว

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

  • @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.

  • @softwareprogrammingdatasci1807
    @softwareprogrammingdatasci1807 10 หลายเดือนก่อน

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

  • @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?

  • @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!!!!🤔

  • @userjdufer466
    @userjdufer466 3 ปีที่แล้ว

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

  • @mikoystories6435
    @mikoystories6435 3 ปีที่แล้ว

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

  • @Midnight-mi3ie
    @Midnight-mi3ie ปีที่แล้ว

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

  • @hessmess9504
    @hessmess9504 3 ปีที่แล้ว

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

  • @rabiahussain4953
    @rabiahussain4953 3 ปีที่แล้ว

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

  • @TheWolf1340
    @TheWolf1340 11 หลายเดือนก่อน

    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

  • @tekturk2167
    @tekturk2167 2 ปีที่แล้ว

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

  • @siyabongahlongwana2386
    @siyabongahlongwana2386 8 หลายเดือนก่อน

    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):

  • @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?

  • @perlasaadeh3322
    @perlasaadeh3322 2 ปีที่แล้ว

    Great explanation! Thank you for sharing

  • @jueha3468
    @jueha3468 3 ปีที่แล้ว

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

  • @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 ปีที่แล้ว

      did u fix this?

    • @TP-mv6en
      @TP-mv6en ปีที่แล้ว

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

  • @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 2 ปีที่แล้ว

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

  • @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.

  • @ДастанАлымбеков-ю5и
    @ДастанАлымбеков-ю5и 3 ปีที่แล้ว

    Thanks for really excellent tutorial, you are the best

  • @mouaadrio5883
    @mouaadrio5883 3 ปีที่แล้ว

    thanks for the video. excellent stuff

  • @matheuslemos8013
    @matheuslemos8013 3 ปีที่แล้ว

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

    • @ivantito2119
      @ivantito2119 2 ปีที่แล้ว

      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

  • @gojosenpai9461
    @gojosenpai9461 3 ปีที่แล้ว

    thanks for the good content keep it going

  • @knowledgetreasure-1523
    @knowledgetreasure-1523 ปีที่แล้ว

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

  • @prakashkombala
    @prakashkombala 3 ปีที่แล้ว

    Very Good Thanks lot

  • @thebrindian939
    @thebrindian939 2 ปีที่แล้ว

    LENG STYL (the voice)

  • @littricks3631
    @littricks3631 2 ปีที่แล้ว

    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  2 ปีที่แล้ว

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

  • @govinej
    @govinej 3 ปีที่แล้ว

    Great video

  • @jalilkdidir
    @jalilkdidir 3 ปีที่แล้ว

    very good

  • @jeromemarbebe3791
    @jeromemarbebe3791 3 ปีที่แล้ว

    thankyou

  • @БогданСтариков-н3ь
    @БогданСтариков-н3ь 2 ปีที่แล้ว

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

  • @salehhassan367
    @salehhassan367 2 ปีที่แล้ว

    أعجبني.

  • @AlbertoBezerraProf
    @AlbertoBezerraProf 2 ปีที่แล้ว

    🎉