Akascape / CTkDesigner-Support

Support page for CTkDesigner - GUI design app for customtkinter
https://ko-fi.com/s/6fca1ae70f
Other
74 stars 0 forks source link

CTkDraw Instantiation Error: x1 must be greater than or equal to x0 #11

Closed Ifelsethendo closed 5 months ago

Ifelsethendo commented 5 months ago

Exception has occurred: ValueError x1 must be greater than or equal to x0 File "C:\Users\IfElseThenDo\Documents\CTKDesignerPy.py", line 18, in Draw1 = CTkDraw(master=root, bg_color="grey", width=200, height=200) ValueError: x1 must be greater than or equal to x0

Simple test of saving things from the application version 4

`import tkinter import customtkinter from PIL import Image from ctkdlib.custom_widgets import * import sys print(sys.path) customtkinter.set_appearance_mode("System") customtkinter.set_default_color_theme("blue")

HEIGHT = 500 WIDTH = 500

root = customtkinter.CTk() root.title("CTKDesignerPy.py") root.geometry((f"{WIDTH}x{HEIGHT}")) root.resizable(False, False)

Draw1 = CTkDraw(master=root, bg_color="grey", width=200, height=200) Draw1.place(x=238, y=262)

Slider1 = customtkinter.CTkSlider(master=root) Slider1.place(x=13, y=299)

Textbox1 = customtkinter.CTkTextbox(master=root, bg_color=['gray92', 'gray14']) Textbox1.place(x=245, y=30)

Button1 = customtkinter.CTkButton(master=root) Button1.place(x=50, y=97)

root.mainloop() `

Note I don't see a CTkDraw in the documentation: https://customtkinter.tomschimansky.com/documentation/widgets

Akascape commented 5 months ago

@Ifelsethendo Not getting this issue, CTkDraw documentation is here: https://github.com/Akascape/CTkDesigner-Support/blob/main/ctkdlib_documentation.md#ctkdraw (it's a custom widget)

image

Maybe update your pillow module version, which version are you using? pip install pillow --upgrade

FoxRunningFromCode commented 5 months ago

To add to his error: Im running pillow version 10.3.0

Draw1 = CTkDraw(master=root, bg_color="#ffffff", path="C:/Users/cb/Pictures/Razer Blackshark V2 Pro.PNG")
Draw1.place(x=107, y=2)

results in the following error:

Traceback (most recent call last):
  File "c:\Users\cb\Pictures\test2.py", line 30, in <module>
    Draw1 = CTkDraw(master=root, bg_color="#ffffff", path="C:/Users/cb/Pictures/Razer Blackshark V2 Pro.PNG",height=200,width=200)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\cb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ctkdlib\custom_widgets\ctk_draw.py", line 50, in __init__     
    self.update()
  File "C:\Users\cb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ctkdlib\custom_widgets\ctk_draw.py", line 100, in update      
    image = self.round_corners(image, self.corner)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\cb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ctkdlib\custom_widgets\ctk_draw.py", line 57, in round_corners
    draw.ellipse((0, 0, radius * 2 - 1, radius * 2 - 1), fill=255)
  File "C:\Users\cb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\PIL\ImageDraw.py", line 177, in ellipse
    self.draw.draw_ellipse(xy, fill, 1)
ValueError: x1 must be greater than or equal to x0

image

Akascape commented 5 months ago

@FoxRunningFromCode Probably a new pillow version issue, I will fix ctkdraw soon.

Akascape commented 5 months ago

@FoxRunningFromCode @Ifelsethendo Fixed, update ctkdlib to 4.1 and it will work properly pip install ctkdlib --upgrade