tksheet icon indicating copy to clipboard operation
tksheet copied to clipboard

deselecting the table

Open janez111 opened this issue 1 year ago • 4 comments

Dear ragardner,

I have (again) a question about your tksheet. Hopefully, I will be clear enough.

When I double-click on a cell in the table, a cursor starts blinking inside it. Pressing Escape removes the cursor, but the cell remains selected (with bolded borders). I am interested in how to completely deselect the table.

I tried using tksheet.focus_out(), but it didn’t work as I hoped. I also tried the deselect function, but it wasn’t successful either.

Do you have any suggestions on how I can fully deselect the table?

Thank you for your time and help!

Best regards, Janez

janez111 avatar Dec 17 '24 14:12 janez111

Hello,

My apologies, hmm, perhaps something is going wrong, but I think in any case this is not explained well enough in the documentation

Did you try:

sheet.deselect() # no arguments

Kind regards

ragardner avatar Dec 17 '24 17:12 ragardner

If you have tried it without arguments already and it doesn't work something must be going wrong and I'll try to figure out what exactly

I will also improve the documentation regardless as I think it's not good enough for this function

ragardner avatar Dec 17 '24 17:12 ragardner

Dear ragardner,

first sorry for the mistake in my prevoius mail, the best worked method tksheet.focus.set() at least it removes the blinking cursor from the cell eventhough that the celly stays sellected. deselect.all() does not worked for me. In particular case i used this tk_sheet.select_all(redraw=True, run_binding_func=True) tk_sheet.deselect(row=0, column=0, redraw=True) and it works, however in most recent case i would really like to deselect all the sheet?

P.S. I used tksheet 6.3.5

Best regads, Janez

On Tuesday, December 17th, 2024 at 18:57, ragardner @.***> wrote:

If you have tried it without arguments already and it doesn't work something must be going wrong and I'll try to figure out what exactly

I will also improve the documentation regardless as I think it's not good enough for this function

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

janez111 avatar Dec 18 '24 14:12 janez111

Ah sorry, my mistake,

Try this instead:

# close any open text editor without setting cell data
# does nothing if one isn't open
sheet.close_text_editor(set_data=False)

# clears all cell selections
sheet.deselect()

You can then use whichever focus functions you need to after the above, if needed

Kind regards

ragardner avatar Dec 18 '24 15:12 ragardner