Don't .pack On The Same Line! - Python Tkinter GUI Tutorial #73

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

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

  • @Codemycom
    @Codemycom  4 ปีที่แล้ว

    ▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My TH-cam Channel:
    bit.ly/2UFLKgj bit.ly/2IGzvOR
    ▶️ See More At: ✅ Join My Facebook Group:
    Codemy.com bit.ly/2GFmOBz
    ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
    Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN

  • @izzyanalytics4145
    @izzyanalytics4145 4 ปีที่แล้ว +10

    Good video. The reason it's a None type is that you are returning the value of the pack/grid method (None) and not the class widget to the variable for assignment. In fact, if you do not plan to act on the widget after creating it with a one-liner, there is really no need to assign it to a variable.

  • @sid.mallick
    @sid.mallick 4 ปีที่แล้ว +3

    I faced this problem a few days ago and had to sort it out by myself. In my opinion, whenever you store the output of an Entry or Label widget in a variable and if you want to use the value of that variable somewhere else, then you should not pack/grid it on the same line.
    If you have no intention to use the value stored in the variable later, then you can safely pack/grid it on the same line. In such cases, you do not even need to assign it to any variable.
    For example, we can write,
    Label(root, text="Anything).pack()
    in stead of,
    my_label = Label(root, text="Anything).pack()
    if we do not want to use the output of this command to any further use.
    At the end, I want to thank Mr John Elder for helping me in growing my Python programming skills. Your simple explanations are unmatched.

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

    wow I desperately needed this information. I am following this tkinter tutorial and i am in video number 18 and learned alot of things.addition i always talk with you up to 0:43 sec while starting your video lol.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      Glad you enjoyed it

  • @antonybrun3845
    @antonybrun3845 4 ปีที่แล้ว +4

    The reason why it returns NoneType is because you are trying to store the return value of the .pack() method into a variable. Since the method does not return anything the program will crash once you try to reference the object you are trying to modify because you aren’t really storing that object. I hope that makes sense

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

    Thanks. I ran into this a lot this weekend making a form for work.

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

      Yeah it trips up a lot of people!

  • @obi666
    @obi666 4 ปีที่แล้ว +1

    Another great video from you, sir!

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

    Hit that like button Python Fans! Great tutorial. Feed the Algorithm!

  • @drednot57
    @drednot57 4 ปีที่แล้ว

    Really useful information. Thanks!

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      Sure thing!

  • @charantechgeek
    @charantechgeek 4 ปีที่แล้ว +6

    Sir,I don't know why our TH-cam channel is not getting more subscribers though having a vey god content.
    #risecodemy

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      Tell your friends :-p

  • @AlissonManiinho
    @AlissonManiinho 4 ปีที่แล้ว

    a question, is any good to have multiple button.configure(somenthing=somthing)? will it clog the cpu or ram, if used too many times? if it will be bad, how can we find a good way to not let the code be spagethy and hard to read?
    exemple:
    Login = tk.Button(Login)
    LoginB.place(relx=0.340, rely=0.725, relheight=0.050, relwidth=0.125)
    LoginB.configure(activebackground="#ececec")
    LoginB.configure(activeforeground="#000000")
    LoginB.configure(disabledforeground="#a3a3a3")
    LoginB.configure(foreground="#000000")
    LoginB.configure(highlightbackground="#d9d9d9")
    LoginB.configure(highlightcolor="black")
    LoginB.configure(justify='left')
    LoginB.configure(text='''Login''')
    LoginB.configure(command=LoginA)

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      It's fine. It won't clog your computer

    • @AlissonManiinho
      @AlissonManiinho 4 ปีที่แล้ว +1

      @@Codemycom thanks for let me know :D, you are a genius, i advanced a lot watching you guides.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      @@AlissonManiinho Happy to help

  • @afridinaseer
    @afridinaseer 4 ปีที่แล้ว

    Sir are you making any tutorial for image recognition? Thanks

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      Not in the immediate future

  • @m_nrn
    @m_nrn 4 ปีที่แล้ว

    i recently discovered your channel through freecodecamp and im wondering if you have addressed the issue of playing video files in tkinter gui's in any of your earlier videos? great content by the way.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Thanks! No I haven't talked about that in any videos yet...

  • @abhasoli2655
    @abhasoli2655 4 ปีที่แล้ว

    It's been a long time since you made some applications with tkinter

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      We made the flashcard app a couple weeks ago

  • @johngiangrande2996
    @johngiangrande2996 4 ปีที่แล้ว

    "Important safety tip." -- Dr. Venkman Pack your sh*t on the next line. :-) Thanks John!

  • @krish3d385
    @krish3d385 4 ปีที่แล้ว

    Sir,can you please tell us how to open another gui python file using a button. I just dont know what fucyion to call or i just dont have any idea. Help me.

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

      Something like this would probably work...
      import os
      def run_program():
      os.system(my_file)
      my_button = Button(root, text="open file", command=run_program).pack()

    • @krish3d385
      @krish3d385 4 ปีที่แล้ว

      @@Codemycom ill check it sir. Thank you for responding. Have a nice day!.

    • @krish3d385
      @krish3d385 4 ปีที่แล้ว

      No sir,it didnt work and i found that adding pyhon before the name of the file worked. Like "python trial.py".

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

    this one is a masterpiece....this NoneType object has no attribute---- thing is nightmare to me.....thnx for the video

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

      Glad you liked it

  • @natansegal9498
    @natansegal9498 4 ปีที่แล้ว

    Hello , I want join to codemy.com but I can't see all your courses . Can you show all list of courses what you have ?
    Thank you

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      On the main Codemy.com homepage it lists all the courses. You can click on them each to read more.

  • @lanelauhoff
    @lanelauhoff 4 ปีที่แล้ว

    1:30 😂😂😂

  • @rcustodian
    @rcustodian 4 ปีที่แล้ว +1

    Pls sir we want
    more

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      Yeah I post several new tkinter videos per week

  • @ClusterSeries
    @ClusterSeries 4 ปีที่แล้ว

    Sir, You have become very skinny 😄