tkinter prob - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: tkinter prob (/thread-24559.html) |
tkinter prob - DPaul - Feb-20-2020 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. RE: tkinter prob - Larz60+ - Feb-20-2020 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. |