You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: possibility of disabling some right-click options #60
Hello. Thank you for great tool. I have small feature request for future versions.
I have tried to disable adding rows and deleting rows for my table and I had to do it manually by changing line in Tables.py
from
general = ["Select All", "Add Row(s)" , "Delete Row(s)", "Auto Fit Columns", "Filter Records", "Preferences"]
to general = ["Select All", "Auto Fit Columns", "Filter Records", "Preferences"]
But it would be nice to make it possible while creating new table, for example:
table = TableCanvas(some_frame, model=model, disable_add_rows=True, disable_delete_rows=True)
It would be good solution to have such parameter for every right-click option. :)
Hey, @hannansatopay Thanks for answer. I know read-only option, I have tested it earlier, but in my particular case I needed to disable only adding and deleting rows to prevent breaking some functionality by user. :)
Hello, It's possible but you have to make a few changes
On your ide navigate to class TableCanvas(Canvas):
With crtl + f look for something like rename column it doesn't really matter the important thing is that you find the popup. You can also look for def popupMenu(self, event): and you will find what we are looking for just below. Note that we have twodef popupMenu( , so changes are slightly different.
You just have to comment on what you don't need.
Example
On def popupMenu(self, event, rows=None, cols=None, outside=None): you have to change:
But you also need to change this list below: general = [...
If you get any errors after doing this it's because some change is missing. In def popupMenu(self, event): changes are slightly different as I said before.
To sum up you just have comment and change values like the ones in general = [... for example.
Hello. Yeah, I was able to do it as I described in my first post by changing "general" list:
I have tried to disable adding rows and deleting rows for my table and I had to do it manually by changing line in Tables.py
from
general = ["Select All", "Add Row(s)" , "Delete Row(s)", "Auto Fit Columns", "Filter Records", "Preferences"]
to general = ["Select All", "Auto Fit Columns", "Filter Records", "Preferences"]
It is only a feature request for developers to make it by parameters:
It would be good solution to have such parameter for every right-click option. :)
For me It would be safer to make such changes in my code rather than tkintertable code. :)
Yes I think since you know how to do it it's better to allow developers to sub-class the table and add this themselves. I generally am not adding new features to this package now, only bug fixes.
Activity
hannansatopay commentedon Oct 7, 2019
Hello @bartlomiejduda Doing something like this would help serve your purpose: TableCanvas(self.tframe,read_only=True)
The above functionality helps make your table read-only!
bartlomiejduda commentedon Oct 7, 2019
Hey, @hannansatopay Thanks for answer. I know read-only option, I have tested it earlier, but in my particular case I needed to disable only adding and deleting rows to prevent breaking some functionality by user. :)
MRES1 commentedon Jul 16, 2020
Hello, It's possible but you have to make a few changes
On your ide navigate to
class TableCanvas(Canvas):With crtl + f look for something like
rename columnit doesn't really matter the important thing is that you find the popup. You can also look fordef popupMenu(self, event):and you will find what we are looking for just below. Note that we have twodef popupMenu(, so changes are slightly different.You just have to comment on what you don't need.
Example
On
def popupMenu(self, event, rows=None, cols=None, outside=None):you have to change:But you also need to change this list below:
general = [...def popupMenu(self, event):changes are slightly different as I said before.To sum up you just have comment and change values like the ones in
general = [...for example.bartlomiejduda commentedon Jul 16, 2020
Hello. Yeah, I was able to do it as I described in my first post by changing "general" list:
It is only a feature request for developers to make it by parameters:
For me It would be safer to make such changes in my code rather than tkintertable code. :)
dmnfarrell commentedon Jul 16, 2020
Yes I think since you know how to do it it's better to allow developers to sub-class the table and add this themselves. I generally am not adding new features to this package now, only bug fixes.