testinggui.py 328 B

1234567891011121314151617
  1. from tkinter import *
  2. import webbrowser
  3. def weblink(*args):
  4. index = lb.curselection()[0]
  5. item = lb.get(index)
  6. if 'https://' in item:
  7. webbrowser.open_new(item)
  8. root = Tk()
  9. lb = Listbox(root)
  10. lb.bind('<<ListboxSelect>>', weblink)
  11. for item in list_of_items:
  12. lb.insert(END, item)
  13. lb.pack()
  14. root.mainloop()