Python Forum
Listbox search code partially works
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Listbox search code partially works
#2
If you ran the code below what do you think it would print? If the if statement was to changed to "if i > 6:" what would it print? Answer that, without actually running the code, and you will know not only why only the first matching item in the itemslist is selected but also why the message box is not drawn.

for i in range(5):
    if i > 2:   # Change this to 6, what is printed then?
        break
    print(i)
else:
    print('Counted to end')
What is printed? If I change the if comparison to i < 12, what gets printed then?
Reply


Messages In This Thread
RE: Listbox search code partially works - by deanhystad - Mar-27-2020, 04:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Search data in treeview without search button TomasSanchexx 3 1,529 Aug-12-2023, 03:17 AM
Last Post: deanhystad
  [Tkinter] add search bar = search for input in all computer directory francisco_neves2020 15 10,769 Apr-14-2019, 07:29 PM
Last Post: francisco_neves2020
  Code fails on Mac, works on Windows and Raspberry Pi eugenedakin 4 3,965 May-30-2018, 03:49 AM
Last Post: eugenedakin
  [Tkinter] THow to search a string in a file and display it in listbox by Tkinter mosavit 2 5,605 Jun-21-2017, 08:02 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020