-
Notifications
You must be signed in to change notification settings - Fork 54
Alignment of special UTF-8 characters on labels #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Also, I searched the documentation but wasn't abble to find anything about remove certain labels/commands from certain cells. We were trying to remove the edit commands for cell also marked as readonly, sinse these commands will have no effect on them. Is there a way to do this today? I understand that, if it still have to be implemented, then it might be easier to just make the NOTE: this last request is different from the one discussed on #281, here were talking about right-click labels on specific cells on the table, more specifically the ones marked as readonly. |
Hello, Thanks for your thoughtful questions, I don't know of any way to align special characters like the icon ones you've shown above except perhaps to use a monospace font. I am however not sure if this would be satisfactory in all cases, I think the best approach would be to use images so I made some changes to that effect. The main changes I've made are numbered below:
popup_menu_add_command(
label: str,
func: Callable,
table_menu: bool = True,
index_menu: bool = True,
header_menu: bool = True,
empty_space_menu: bool = True,
image: tk.PhotoImage | Literal[""] = "",
compound: Literal["top", "bottom", "left", "right", "none"] | None = None,
accelerator: str | None = None,
) -> Sheet
Kind regards |
Hello! How are you doing? First of all, thank you very much for your quick response. I have been working tirelessly to finalize the integration of tksheet in my project. Now practically all of our functionalities use it, whether for batch data entry or for displaying reports. Soon we will also use tksheet's TreeView mode to implement access management and even configuration management functionalities. The new feature with the window in light mode looks very nice, excellent work: However, in dark mode the disabled items are quite blurry. Could you take a look, please? Sample python 3.12.8 code: #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import weakref
from tkinter import messagebox, simpledialog
from typing import Any, Callable, Literal, cast
import customtkinter as ctk
import tksheet
class TableFrame(ctk.CTkFrame):
def __init__(self, master: Any, **kwargs: Any) -> None:
super().__init__(master, **kwargs)
# Creating the spreadsheet as an attribute
self.sheet: tksheet.Sheet = tksheet.Sheet(
self,
headers=["A", "B"],
data=[['1', '2'], ['3', '4']],
### Theme
theme="dark green",
# theme="light green",
)
self.sheet.pack(expand=True, fill="both")
self.sheet.enable_bindings("all")
# Creating a highlighted readonly span
span: tksheet.Span = self.sheet.span(0, 1, 2, 2)
span.highlight(bg="green", fg="black", redraw=False)
span.readonly(True)
# Labels translation
self.sheet.set_options(
copy_label="Copy",
paste_label="Paste",
edit_cell_label="Edit",
delete_label="Delete",
cut_label="Cut",
sort_rows_label="Sort Asc.",
sort_rows_reverse_label="Sort Desc.",
delete_rows_label="Delete row(s)",
insert_rows_above_label="Add 1 row above",
insert_rows_below_label="Add 1 row bellow",
insert_row_label="Insert 1 row",
clear_contents_label="Clear",
copy_contents_label="Copy",
cut_contents_label="Cut",
undo_label="Undo",
select_all_label="Select All",
)
def main():
ctk.set_appearance_mode("light")
ctk.set_default_color_theme("blue")
root = ctk.CTk()
root.geometry("800x400")
root.title("customtkinter + tksheet")
tabela = TableFrame(root)
tabela.pack(expand=True, fill="both", padx=10, pady=10)
root.mainloop()
if __name__ == "__main__":
main() Best regards |
Hello, Thanks for letting me know how you're making use of tksheet! It's nice to hear people are finding it useful 😃 About the blurring issue with the menu items in dark colors... It seems like disabled menu items have issues on dark backgrounds with some operating systems or fonts (i'm not sure which) regardless of what I try to do about it. I had to make it so that the menu items are built on the fly upon a right click event so that disabled items, such as edit, undo or redo are excluded if they are not necessary. This change is in Kind regards |
Thank you very much for the reply and the new version, @ragardner! Hiding disabled labels is actually better, and it also solves some issues. The only thing I think is still missing, is to hide Cut, Paste and Delete labels from read-only cells. Images from the code of last example above. Best regards |
Hello again, how are you doing?
I'm not sure if I should open an issue since I basically have a question.
It turns out that we are trying to add special UTF-8 characters to the labels as in the example below, but visually the text sometimes becomes misaligned as you can see in the print. I would like to know if there is any way to make the special characters align one below the other and also to make the texts aligned to the left between the labels.
Python 3.8.12 example:
Best regards
The text was updated successfully, but these errors were encountered: