Dependent Drop Downs and List Boxes - Python Tkinter GUI Tutorial

Поделиться
HTML-код
  • Опубликовано: 4 фев 2025
  • In this video I'll show you how to create dependent drop downs, combo boxes, and list boxes for Tkinter.
    A Dependent dropdown or listbox is one that changes based on what you clicked in the previous box.
    In our example, we'll create a sizes dropdown that has small, medium, and large sizes. When you click on one of them, a second list appears with the colors (red, green, blue, black) that are available for each size.

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

  • @Codemycom
    @Codemycom  4 года назад +2

    ▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My RUclips 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
    ▶️ Get The Code
    bit.ly/39Zwje7

  • @vincenzo3292
    @vincenzo3292 4 года назад +1

    Thank you for making this video. Been studying tkinter, namely the dep drop-down, but there isn't much out there on that topic. I like how you explain each line of code, what it is for, etc. - that helps to understand the nuances of the framework. I am building a Covid metrics display for work, showing data for each county of every state (number of infected each day, aggregate average, etc.), and this GUI piece is critical for the everyday computer user to make selections. Thanks!

  • @chococandy8009
    @chococandy8009 4 года назад +1

    Thank you sir, your videos are really helping me in my gui tkinter project. Keep it up and we are waiting for more such fantastic videos :)

    • @Codemycom
      @Codemycom  4 года назад

      Glad you're enjoying them!

  • @3zq3mh1
    @3zq3mh1 2 года назад

    Man! You make it seems so easy!

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

    Great job, John!

  • @ahmetbayramtoluc3079
    @ahmetbayramtoluc3079 4 года назад +1

    Hi John. Thanks for great videos. Can you make please make a video which shows how to create a toplevel window inside a main window even if i drag it out.

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

    Hi John Thanks lot for great videos

  • @robh9184
    @robh9184 4 года назад +1

    This function is really useful thanks!
    As a side note: I have always wondered why we still have to import stuff for Tkinter (eg 'from tkinter import ttk') when we have already imported everything with * (eg 'from tkinter import *')? Seems a bit weird to me. I guess that * refers to all from a basic tkinter package?
    Anyways.. keep up the good work!

    • @Codemycom
      @Codemycom  4 года назад +2

      Thanks! Yeah I've always thought it was weird too.

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

    This is great video. I tried this for a similar application in abaqus viewer software. Could you please show how to add a text to the left side of the drop down box? Something like to prompt the user on what is expected to be selected in the dropdown.
    Also please make a video on how to use the dropdown selection in further code/ application.

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

    I just learning about database and I need a way to show item name and the amount of the item. This video help me to do that. So when I choose an item from the first dropdown, the second dropdown will be populated by numbers with the maximum amount is the amount of the item in database.
    I will try to combine them later so I can make update or insert function to manipulate the database based on the values of both dropdown.

  • @KvDlifevlog
    @KvDlifevlog 4 года назад

    hey John thank your wonderful lessons......waiting Tkinter login system...video

    • @Codemycom
      @Codemycom  4 года назад

      I already have videos on using databases..which is all you need for a login system.

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

    Great video!!! I do have a question...How does one change the location of the drop-down box? I tried using .grid but didn't get the results I wanted.

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

      You just need to use .grid (or .pack for that matter) correctly.

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

    Is it possible to make the list box dependent on what you choose in a combo box?

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

    I have e been looking for this and trying everything I could think of for a week. You’re awesome!!!!! CN you bind to a SQLite3 DB as well?

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

      yeah I have a bunch of videos on that

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

    This is awesome.. can we bind and make 3 comboboxes and make it dependent.. like state, city and ,zip code.. can you help

    • @Codemycom
      @Codemycom  3 года назад +2

      Sure you can do that. give this a look:
      ruclips.net/video/bH9r3wM9Idw/видео.html

    • @amitkore9344
      @amitkore9344 3 года назад +3

      @@Codemycom i think you gave the same video link..Do you have any video where you described 3 dependent option box

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

    Awesomeee!! How can we pass index number of selection from 1st drop-down list to 2nd drop-down list?
    Imagine that we have same number of elements in the size and color lists and want to select 2nd drop-down list automatically via index number of 1st selection.

  • @bcod53_rushabhbelani50
    @bcod53_rushabhbelani50 4 года назад

    sir really searchig for this thanx

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

    how do i get a copy of your code for each module so that i can just copy paste and run them for practise so i dont make much errors typing eachline of code.
    the best tutorials.thanks

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

      The code is always pinned in the comment section...but copying and pasting code is no practice at all lol How does that help you learn?

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

    what is "e" that passed to the function? My IDE does not recognize "e")

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

    Hi! Could you help me please, how can i use this widget in kivy? Thank you!

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

      You can't use anything from Tkinter in Kivy ever. They're completely different things

  • @1504shubham
    @1504shubham 4 года назад

    where can i get the source code of these examples shown in videos ? do u have any github repo ? it will be really helpful if can get.

    • @Codemycom
      @Codemycom  4 года назад

      Link in the pinned comment of every video.

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

      @@Codemycom There is no pinned comment on this video!

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

      @@peterlyon185 Yes there is

  • @capincrunch1184
    @capincrunch1184 4 года назад

    Any way you could show how to get the drop down to take data from excel

    • @capincrunch1184
      @capincrunch1184 4 года назад

      Trying to make it update certain specifications from excel

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

    When we use .Current(0) function in definition.. it won't allow us to select anything apart from the 1st option form the list.. how we can solve this

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

      No, I don't think that's true. current must be lowercase.

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

      @@Codemycom yes.. i tried this.. and it wont allow me to select anything else

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

      @@amitkore9344 Then you did something wrong. You have a typo somewhere or did something different than my video. Are you using different tools like IDLE or something weird like that?

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

      @@Codemycom hi.. thanks for your response.. i have created 4 combobox and as state, city, pin and locality..
      And have bind then within same.. have set to use current to 3 comboboxes as you defined.. but the values set as (0) dosnt allow to select any other values

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

      @@amitkore9344 Yes, you've explained already that you're having a problem, and I've told you already that you've made a mistake and have a typo somewhere.

  • @ZakariaMokhtari-v8v
    @ZakariaMokhtari-v8v Год назад

    شرح رائع Thank you

  • @markhillman1450
    @markhillman1450 4 года назад +1

    I am using the same if my_combo.get() = = "Female" and it is not working. (Female is part of my list)

    • @Codemycom
      @Codemycom  4 года назад

      is Female capitalized in your list?

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

    thanks for you help

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

      Thanks for watching

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

    Sir...how can we get color drop-down values printed ? Please help

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

      Not sure I understand what you're asking

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

      I'm able to get the value of small - color drop-down values using .get only once when I change the drop-down value to something else it is not returning anything

  • @codingstudio8865
    @codingstudio8865 4 года назад +3

    Sir , please bring C# GUI courses.

    • @Codemycom
      @Codemycom  4 года назад +1

      I'm not a c# guy

    • @Codemycom
      @Codemycom  4 года назад

      @@JirayuVijjakajohn No...not for like 30 years lol

  • @DEEPAKTHAKUR-tm7tr
    @DEEPAKTHAKUR-tm7tr 3 года назад

    I have some value in a textbox and i want it to get into a Dropdown

  • @livingstongraphics
    @livingstongraphics 4 года назад +1

    this is greate

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

    🔥🔥🔥

  • @johnackelley
    @johnackelley 8 месяцев назад

    Is there a reason not to make it a dictionary? Just asking because I genuinely don't know and for all I know using a dictionary could be less efficient or cause other problems.
    ```
    size_color_dict = {
    'small': [
    'red',
    'green',
    'blue',
    'black'
    ],
    'medium': [
    'red',
    'green'
    ],
    'large': [
    'blue',
    'black'
    ]
    }
    my_combo = ttk.Combobox(root,value=list(size_color_dict.keys()))
    ```

    • @Codemycom
      @Codemycom  8 месяцев назад +1

      No particular reason so long as it works ;-)

  • @albertdupond7399
    @albertdupond7399 4 года назад

    Fine

  • @charantechgeek
    @charantechgeek 4 года назад +1

    Hae john

  • @jamikemichelohia2615
    @jamikemichelohia2615 4 года назад

    Just in time