Remove Labels - Python Tkinter GUI Tutorial #41

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

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

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

    Big fan of your tutorials! Super helpful for someone starting out with tkinter. Keep at it!

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

      Thanks, will do!

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

    i will never understand how people can dislike this, he is literally giving us all this knowledge so EASY and for FREE and some people dare to give a thumbs down, thats INSANELY STUPID

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

    You are the man. GOD bless you and your family

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

      Thanks, you too!

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

    Im learning a lot quicker then I thought I would thanks to your videos

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

      Glad to hear it!

  • @duhmi
    @duhmi 4 หลายเดือนก่อน

    Thanks from my heart
    I learn a lot from your videos

    • @Codemycom
      @Codemycom  4 หลายเดือนก่อน

      Glad to hear that

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

    thx so much John for charing these awesome videos! The videos are very helpful and u r just a great teacher. Greetz from Germany 👍

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

      Thanks so much! I appreciate it!

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

    to make your text changes dynamically use textvariable
    thank you a lot mr john for this awesome course

  • @Vivian-yf4qw
    @Vivian-yf4qw 4 ปีที่แล้ว +3

    Thank you! Your tutorials are super helpful 😊

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

      Glad you like them!

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

    I'm very glad I found this video!!!
    Thank you so much, very helpful🙂👍

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

      Glad you liked it!

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

    I was looking for this for a long time thank you

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

      Glad you found it!

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

    why wouldn't the best option be just to reconfigure the label with the new user input each time? (label.config)

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

      this seems to work just fine, or even better. Instead of having a separate delete method I just used label.configure() on the myClick method.

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

      @@deshanfernando7982 How bro ?

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

    Thank you
    بارك الله فيك

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

      You're welcome!

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

    Hello, when i run the program appears"AttributeError: 'NoneType' object has no attribute 'pack_forget'".Why is this happening?. Its only when i click on "Delete Button". Sorry bad my english for... ^-^

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

    John, suppose you click on 'Enter your name' multiple times, the name will be printed multiple times one below the other. How can we delete all instances of the labels at once? If you have already discussed this can you please tell me which videos to look at?

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

      I'm sure I have, but I don't recall where

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

    how to do that without button

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

      Do you mean with telepathy?

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

    sir cant we use pixel without grid or pack

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

    Thx John, 감사합니다!

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

    I don't know if I have overlooked it or not, but how do you recall a widget after using either grid or pack_forget?

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

      In the normal way you always call a widget

  • @user-pu4xj1bv3u
    @user-pu4xj1bv3u 2 ปีที่แล้ว +1

    Hello, if we put an If in function myClick and we put a label in this If, remove will not work because the label is not defined. Solution ?

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

      Define it, make it global

  • @kleinerdiamant-bs
    @kleinerdiamant-bs 2 ปีที่แล้ว

    I always get AttributeError: “NoneType” object has no attribute “pack_forget”. Pls help :(

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

      Did you define the thing, and pack the thing on the same line? You can't do that.

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

    John, what if you only have one button (Enter your name), then you want to clear the previous label before the next one appears on the same line or for shot can the same task you are doing there be archived with only one button?

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

      Use .config()

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

    I do want to make a intro but when I say 'time.sleep(5)' and remove the label the program waits for 5 seconds and then my root is visible please help

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

    Thank you very much

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

    How do I delete multiple labels under the same variable name,which r being displayed using a loop,like if I use destroy or forgot method it only deletes the last label displayed but the rest of the label's still remain,can u help me out sir, please

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

    @2:29/9:57 Instead of writing "end" it should be "END" in uppercase

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

    sir i m using the .grid() instead of .pack() and when i want to delete the label with .destroy() method i doesn t work

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

      Has nothing to do with grid or pack, you likely have a typo somewhere

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

      @@Codemycom Thanks sir i fixed it , Your vids are awesome !

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

    bad window path name error

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

      What did you do differently from the video?

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

    Is this method aplicable for images that after opening second image forgot first image as well as label ?

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

    hi, what it you put three labels on the screen and you wanted to delete the last two, how would you do that. right now I am only able to remove the last label added.

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

      in the same way you would remove any label.

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

    When I try this in my code I get TypeError: pack_forget() missing 1 required positional argument: 'self' Any ideas?

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

    I am using this method to forget every widget in tkinter but I am not able to restore it:
    def settings():
    list = root.place_slaves()
    for l in list:
    l.forget()

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

    does it work for button also??

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

    Hi, how we can use Bash(Shell) in tkinter?
    Entry-> label-> take label to subproces -> example 'grep label_text filepathfromsecondentry -> save output in file from entrynumber3

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

      The same way you would ever use Bash(shell) in any python program...

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

    sir, destroy() function does not work tell me why!!!!

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

      Because you're using it wrong or there's an error in your code

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

    Is there any way to delete the label automatically? Like You click the button to submit your name, then the label shows for 5 seconds or so then gets deleted?

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

      yep...I have videos on timers on the playlist

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

    Ok so i am using the .destroy() function but.. it doesnt work and it doesnt print an error so please help because i dont know whether this is a version problem or just if i am doing it wrong

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

      It's not a version problem, you're likely just doing it wrong...

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

    Exception in Tkinter callback
    Traceback (most recent call last):
    File "C:\Users\shaan\anaconda3\lib\tkinter\__init__.py", line 1883, in __call__
    return self.func(*args)
    File "C:\Users\shaan\Downloads\ADV-C145-student-20201209T202452Z-001\ADV-C145-student\SuveyAPP.py", line 19, in remove
    label_title.destroy()
    AttributeError: 'NoneType' object has no attribute 'destroy'
    This error has no clue to solve it. I Tried it a thousand times but it didn't work

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

      You packed and defined your label on the same line didn't you? Don't do that.

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

    Can you help me, when I disable the button it says the following error:
    btcalcular['state'] = DISABLED #btcalcucar is name button
    NameError: name 'DISABLED' is not defined

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

      I solve it :
      btcalcular.configure(state='disabled')
      in phyton 3.10.8

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

    Could we do this with images?I am trying to display 700 images from a file onto a gui,I display one and then overwrite it after 0.5 s

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

      Not sure what you mean

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

    Hello sir how would i delete the label without the delete button inside the myclick function itself so that after printing the name for first time and then when i type other name and click the enter my name button the previous name is deleted and the new name is printed in the window
    please help me with this

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

      use .config()...I have videos on this in the playlist

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

      @@Codemycom sir I have used it works for smaller programs but in larger programs like hangman game it doesn't work
      It gets overridden

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

    How can we delete each single entry every time by clicking button ?

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

      give the button a command that points to a function that does exactly that

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

    how can i replace a specific word in text widget ? ... for example i typed words then i selected one of them and used text.selection_get() method, i want to replace the word i select with another word.

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

      Try string replace variable.replace(old, new)

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

      actually the word will replaced after right-clicking, but I just don't know how to replace only the word I selected not the whole text.

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

      @@Se_1364 yeah, string replace works there. variable.replace("red", "blue") replaces the word red with the word blue. Obviously you'll have to tweak it for tkinter.

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

      Codemy.com thank you I will try it

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

    showLFSlabel.pack_forget()
    AttributeError: 'NoneType' object has no attribute 'pack_forget', i dunno why that error

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

      You probably defined and packed the label all on the same line. You can't do that.

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

    Really love you videos.
    But i have one problem, when i create more than one label and then try to delete more than one i can only delte one label and not the other ones. can anybody tell me why that is?

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

      It's because you're doing something wrong. Are you naming the labels all the same thing or something?

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

      @@Codemycom yeah I create them with a function and then put all of them in a list and then i tried to to destroy them in from the list but it doesn't work. But I also found your video about the todo list and that's what I'm looking for.

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

    How to delete a label on a grid though? Need help :(

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

      In the same way... it being on a grid is irrelevant

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

    hi ! how can i remove a label with the same button

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

      doesn't this video show you that?

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

      @@Codemycom No i mean remove it with the same buttom that enter it
      like a sign up thing
      if the password has less than 8 characters the label shows up and if he edit it and make it more than 8 char the label goes

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

      @@abnalgeria4598 sure, use basic python for that. I don't have videos on it but it would be trivial with a little if/else logic.

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

      @@Codemycom it showed an eror but im gonna try again anyway thnx btw love ur videos

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

    i am learning python, as it is my hobby learning codding,i wish to be professional in python, how can you help me,, i like the way you explain though you are little fast.

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

      Just watch all the videos on my channel

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

    this today is not working anymore, python 3.10 know why?

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

      You're wrong, it works fine today. You just did it wrong.

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

    why heisenberg is teachin python?

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

      Why not?! lol

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

    Can we maybe get a "Boom! Nothing happens" tshirt

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

    nice

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

    forget is not defined
    How to fix it?

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

    its easy to do it just use destroy cmd or wnt to change text on label just type label.config(text="codemy.com")

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

      yeah, we do that several thousand times throughout this playlist :-p

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

      @@Codemycom :-D

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

      @@Codemycomi learn python gui from you john your a great teacher thanks from sri lanka

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

      @@netharuM Glad you're enjoying the videos!

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

    HOW to change a label in tkinter and not change the new label when you restart the program

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

      Everything always reverts when you restart it, unless you use a database to record the changes. Or some other save method.

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

    how to destroy a placed label insted of pack

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

      .destroy() usually does the trick

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

    Now, how to erase Entry boxes? I do that?????

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

      I have videos on that.

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

    how to delete label without using button

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

      Do you mean telepathically?

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

      @@Codemycom I developed love calculator application using tkinter in python I am unable to delete label without clicking on a button

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

      @@garikinarajesh1999 Yeah, what other way do you think you could do it short of telepathy. It's a computer program, you have to click something to interact with it.

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

    How to delete all LABEL WIDGETS in tkinter

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

      loop thru and destroy all children..I have videos on it in the playlist

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

    @3:49 this thing also happened with me

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

    please, how can we save, in a text file, all the values of variables coming from the Print command, displayed in the "RUN" window of PyCharm. I'm a beginner. Mecri of your time

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

      Sorry, I don't use pycharm, so I have no idea. But you can google "Python save to text file" to learn how to read and write to a text file.

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

    ▶️ 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
    Take $30 off with coupon code: youtube1