Python Forum

Full Version: tkinter prob
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am using tkinter and may be doing something not allowed.

Here is the pseudocode:
I have a listbox with items in it.
When i click on an item it gets selected and also gets focus.
i put the descriprion of the selected item in a variable and do something with it.
So far so good.
At the end of the click_event, i want to move the focus onto an entry field with a entryfield.focus().
It refuses to do that, i have to do it manually with tab.

Question:
Is there a rule that says that if you manually click ("select") on a listbox (thus receiving focus),
you cannot expect the code in this click event to move focus to something else?

def on_select(evt):
    global currentImage
    w = evt.widget
    index = w.curselection()[0]
    currentImage = w.get(index)
    entryScore.focus()
thx,
Paul

EDIT: after testing, i have a result. Setting the listbox state to 'disabled' does the trick. Focus shifts to only other focusable field.
Are you getting an error message?
If so, please post (complete and unaltered in error tags)

I'm thinking this might be a scope problem, hard to say without supporting code.
Code submitted should always be enough to run and recreate the problem.