Learn Python tkinter GUI listboxes easy 📋

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

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

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

    # listbox = A listing of selectable text items within it's own container
    def submit():
    food = []
    for index in listbox.curselection():
    food.insert(index,listbox.get(index))
    print("You have ordered: ")
    for index in food:
    print(index)
    def add():
    listbox.insert(listbox.size(),entryBox.get())
    listbox.config(height=listbox.size())
    def delete():
    for index in reversed(listbox.curselection()):
    listbox.delete(index)
    listbox.config(height=listbox.size())
    from tkinter import *
    window = Tk()
    listbox = Listbox(window,
    bg="#f7ffde",
    font=("Constantia",35),
    width=12,
    selectmode=MULTIPLE)
    listbox.pack()
    listbox.insert(1,"pizza")
    listbox.insert(2,"pasta")
    listbox.insert(3,"garlic bread")
    listbox.insert(4,"soup")
    listbox.insert(5,"salad")
    listbox.config(height=listbox.size())
    entryBox = Entry(window)
    entryBox.pack()
    frame = Frame(window)
    frame.pack()
    submitButton = Button(frame,text="submit",command=submit)
    submitButton.pack(side=LEFT)
    addButton = Button(frame,text="add",command=add)
    addButton.pack(side=LEFT)
    deleteButton = Button(frame,text="delete",command=delete)
    deleteButton.pack(side=LEFT)
    window.mainloop()

    • @dumandanarnela.6831
      @dumandanarnela.6831 2 ปีที่แล้ว +1

      how to show the deleted items and remove from the box at the same time

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

    Best video in the whole TH-cam. Not even kidding. Thanks a ton

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

    Best channel yet, this is the best pre-course material ever. This smokes everything except coursera but in ways still out does coursera

  • @toddlawrimore3577
    @toddlawrimore3577 5 หลายเดือนก่อน

    Helpful and especially direct to the subject. I am a fan. Thank you.

  • @hydarhydar2338
    @hydarhydar2338 20 วันที่ผ่านมา

    Well Well ❤ thank you for the very helpful tutorials

  • @_zitsu_k
    @_zitsu_k 7 หลายเดือนก่อน

    you are the GOAT of coding,
    love from earth 🌏

  • @_zitsu_k
    @_zitsu_k 7 หลายเดือนก่อน +2

    how many centuries it takes to be like you bro?

  • @paulfernando8815
    @paulfernando8815 7 หลายเดือนก่อน

    Nicely explained. But I did not see the usual comments added at the end of the code lines in this.

  • @hamzazad5258
    @hamzazad5258 6 หลายเดือนก่อน

    great video! loved coding along in this one

  • @Complex2.0GameR
    @Complex2.0GameR 9 หลายเดือนก่อน

    Your are best bro ....love from bangladesh

  • @KhoaNguyen-bk2kv
    @KhoaNguyen-bk2kv 3 ปีที่แล้ว +2

    A useful video. Thanks bro.

  • @_zitsu_k
    @_zitsu_k 7 หลายเดือนก่อน

    please can you make a guidance video of how to get in freelancing with coding

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

    Super video Bro! 🎉🎉

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

    thank you for such a great tutorial :)

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

    Fast, but really good. Thx

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

    Great tutorial! :)

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

    If .size() returns the size of the list, how come it doesn't replace the latest entry's index when used in .insert()?
    Apparently I can use END for the first argument of .insert() to add a new entry at the end of the list without weirding myself out.

    • @nearo007
      @nearo007 6 หลายเดือนก่อน +1

      this is one year later but basically:
      the list ["hot dog" , "pizza" ] has the size of 2 items
      but the index of the last item is actually 1 (because it starts at 0)
      so inserting the index 2 would be the 3rd item on the list

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

    Great vidéo.

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

    can somebody help me how can I put exception handling when user did not select anything from the listbox but did click the delete button?

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

    Is there any way to make the columns resizable by clicking and dragging on top box in a column? (like you can most other prorgrams' listboxes)

  • @sidtheepic1103
    @sidtheepic1103 6 หลายเดือนก่อน

    Can someone explain the reversed thing, thats the only thing i find confusing.

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

    We're going to break it Bro 👍👌

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

    great show

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

    Great!

  • @Data_Falcon
    @Data_Falcon 5 หลายเดือนก่อน

    bro it is very helpfull

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

    Thank you 😁👍👍👍👍

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

    شكرا

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

    Ty bro!

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

    thanks!!!

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

    Wow!!!!

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

    meow meow meow~!

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

    can somebody help me how can I put exception handling when user did not select anything from the listbox but did click the delete button?

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

    can somebody help me how can I put exception handling when user did not select anything from the listbox but did click the delete button?

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

    can somebody help me how can I put exception handling when user did not select anything from the listbox but did click the delete button?

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

    can somebody help me how can I put exception handling when user did not select anything from the listbox but did click the delete button?

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

      try cutting the delete button then paste it in a try...except clause
      idk if it helps
      try:
      deleteButton = Button(window,text="delete",command=delete)
      deleteButton.pack()
      except Exception:
      print("your text here")
      you should ask in stack overflow btw