Python Forum
[PyGUI] ListBox Update Issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGUI] ListBox Update Issue
#1
Hi,

I'm trying to update a PySimpleGui LixtBox contents on run time. I've done done that using

window['_LISTBOX_'].update(['new','value'])
The new Listbox content appears on the screen, however on the event loop I'm not able to get the line the user clicked into it, it seems to be empty.

I think I updated the values, but not the keys.

Here's how I treat the event inside the event loop

if event == '_LISTBOX_':
    print(values) # This line is printing nothing
    if len(values['_LISTBOX_']):     # if a list item is chosen
       dosomething(values['_LISTBOX_'])
I've created the Listbox with the folowing code

g.Listbox([], enable_events=True, size=(43, 10), auto_size_text=True, key='_LISTBOX_',
                    select_mode=sg.LISTBOX_SELECT_MODE_SINGLE, bind_return_key=False, change_submits=True)
I've created the Listbox empty, then I insert some content on running time.

Thanks for any help.
Reply
#2
Please your arrange code into a runnable snippet.
Thank you
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Progressbar value update issue Roshan 7 3,319 Apr-22-2020, 04:02 PM
Last Post: deanhystad
  [PySimpleGUI] update listbox not working zappfinger 2 12,088 Nov-12-2018, 08:33 PM
Last Post: zappfinger

Forum Jump:

User Panel Messages

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