Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter prob
#1
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.
Reply
#2
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.
Reply


Forum Jump:

User Panel Messages

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