Comments (4)
Re,
I did a monkey patch.
def create_text_editor(self, r = 0, c = 0, text = None, state = "normal", see = True, set_data_ref_on_destroy = False, binding = None):
. . .
elif binding is None and set_data_ref_on_destroy:
self.text_editor.textedit.bind("<Return>", lambda x: self.get_text_editor_value((r, c, "Return")))
self.text_editor.textedit.bind("<FocusOut>", lambda x: self.get_text_editor_value((r, c, "FocusOut")))
self.text_editor.textedit.bind("<Escape>", lambda x: self.get_text_editor_value((r, c, "Escape")))
self.text_editor.textedit.bind("<Tab>", lambda x: self.get_text_editor_value((r, c, "Return"), move_down=False, move_right=True))
. . .
def bind_text_editor_destroy(self, binding, r, c):
self.text_editor.textedit.bind("<Return>", lambda x: binding((r, c, "Return")))
self.text_editor.textedit.bind("<FocusOut>", lambda x: binding((r, c, "FocusOut")))
self.text_editor.textedit.bind("<Escape>", lambda x: binding((r, c, "Escape")))
self.text_editor.textedit.bind("<Tab>", lambda x: binding((r, c, "Return")))
self.text_editor.textedit.focus_set()
def get_text_editor_value(self, destroy_tup = None, r = None, c = None, set_data_ref_on_destroy = True, event = None, destroy = True, move_down = True, move_right=False, redraw = True, recreate = True):
. . .
if move_right:
if r is None and c is None and destroy_tup:
r, c = destroy_tup[0], destroy_tup[1]
currently_selected = self.currently_selected()
if r is not None and c is not None:
if (
currently_selected and
r == currently_selected[0] and
c == currently_selected[1] and
(self.single_selection_enabled or self.toggle_selection_enabled)
):
self.select_cell(r , c+1 if c<len(self.col_positions) - 2 else c)
self.see(r, c+1 if c < len(self.col_positions) - 2 else c, keep_xscroll = True, bottom_right_corner = True, check_cell_visibility = True)
. . .
Plus I added <Tab>
in the bind of arrowkeys.
It's 90% the same behavior as in excel. It does job.
from tksheet.
It should be added in 4.9.7
but try it out and let me know if it's not working correctly
from tksheet.
Regarding
In a more generic way, can we just add the possibility of binding other keys on the text editor?
I added the below code in version 4.9.7
def bind_key_text_editor(self, key, function):
self.MT.text_editor_user_bound_keys[key] = function
def unbind_key_text_editor(self, key):
if key == "all":
for key in self.MT.text_editor_user_bound_keys:
try:
self.MT.text_editor.textedit.unbind(key)
except:
pass
self.MT.text_editor_user_bound_keys = {}
else:
if key in self.MT.text_editor_user_bound_keys:
del self.MT.text_editor_user_bound_keys[key]
try:
self.MT.text_editor.textedit.unbind(key)
except:
pass
It's not perfect though because you can't really bind keys to the text widgets actual functions, I might add this functionality later, but I can't give you a time frame sorry
from tksheet.
The functionality for the event <Tab>
is working fine. 👍
No worries, it's not a priority.
from tksheet.
Related Issues (20)
- Add prompt for wrong keyward args in get_sheet_data/get_cell_data/get_row_data/get_column_data HOT 1
- Issue with set_sheet_data HOT 6
- Manually set displayed row index HOT 3
- Dropdown menu fails to open if some rows are hidden HOT 2
- Update cells data using specific conditions on user input. HOT 27
- SyntaxWarning HOT 3
- Currently selected cell rows in sheet vs in data HOT 2
- on Rpi5, OS debian bookworm, tksheet's sheet defined col-w & row-h of 10x16 cells size has slow/lagging mouse's cursor movement HOT 12
- How to fix the maximum size of characters in tksheet ceels HOT 6
- The tabel font does not change. HOT 1
- How to Check if a Check Box is checked in tksheet 7 HOT 1
- How to accept user input even if "enter" is not pressed HOT 4
- Looking to customize scrollbar and scrollbar frame bg HOT 2
- Don't work keyboard UP arrow when navigating through the table of tksheet HOT 1
- Multiple issues with Toggle Select Mode
- Partial Horizontal Scrolling HOT 2
- Rows sorting? HOT 2
- Cell Selection Persistence HOT 2
- Keypad enter button ignored HOT 2
- Quotes multiplies when i copy text from cell with ctrl+c or popup menu. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tksheet.