-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
Hello again, @ragardner. How are you doing?
I've recently noticed a bug when we use clipboard_function (both custom or the default one) if some cell text has the "
character on it. Here follows a sample code and steps for reproduction:
#!/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, 'text"'], ['', '3']],
)
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)
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()
Steps to reproduce:
Scenario 1: WORKS 100%
- Select cell B1, then press
CTRL+C
(same using the rc copy feature) - Now paste the text into a notepad (
Windows Notepad
, for example) - The pasted text will perfectly correspond to the one inside the B1 cell
Scenario 2: FAILS
- Select cells B1 to B2, then press
CTRL+C
(same using the rc copy feature) - Now paste the text into a notepad (
Windows Notepad
, for example) - The pasted text corresponding to the cell B1 will not represent properly the text actually inside it
Scenario 3: FAILS
- Select cells A1 to B1, then press
CTRL+C
(same using the rc copy feature) - Now paste the text into a notepad (
Windows Notepad
, for example) - The pasted text corresponding to the cell B1 will not represent properly the text actually inside it
Tested on: Windows 11, Python 3.12.8 and tksheet 7.5.12
Best regards
ragardner
Metadata
Metadata
Assignees
Labels
No labels