TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
10.8k stars 1.03k forks source link

canvas.coords is not returning any values #2353

Open boreland opened 3 months ago

boreland commented 3 months ago

Describe the bug

Expected behavior

To Reproduce

tkinter example that works correctly

furas commented 2 months ago

EDIT:

There are other bug reports for this problem:

https://github.com/TomSchimansky/CustomTkinter/issues?q=is%3Aissue+is%3Aopen+coords


I found that canvas.coords needs return in some lines with super() in file

customtkinter/windows/widgets/core_rendering/ctk_canvas.py 

similar to

    def coords(self, tag_or_id, *args):

        if type(tag_or_id) == str and "ctk_aa_circle_font_element" in self.gettags(tag_or_id):
            coords_id = self.find_withtag(tag_or_id)[0]  # take the lowest id for the given tag
            return super().coords(coords_id, *args[:2])

            if len(args) == 3:
                return super().itemconfigure(coords_id, font=("CustomTkinter_shapes_font", -int(args[2]) * 2), text=self._get_char_from_radius(args[2]))

        elif type(tag_or_id) == int and tag_or_id in self._aa_circle_canvas_ids:
            return super().coords(tag_or_id, *args[:2])

            if len(args) == 3:
                return super().itemconfigure(tag_or_id, font=("CustomTkinter_shapes_font", -args[2] * 2), text=self._get_char_from_radius(args[2]))

        else:
            return super().coords(tag_or_id, *args)

but I'm not sure if all super() need return.

I didn't check it but I think canvas.itemconfig may also need return in some lines with super() to return value.