Skip to content
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

customtkinter not working #248

Closed
OtherwisePitt opened this issue May 1, 2024 · 8 comments
Closed

customtkinter not working #248

OtherwisePitt opened this issue May 1, 2024 · 8 comments

Comments

@OtherwisePitt
Copy link

hi, while i'm trying to use customtkinter, for every CtkWidget propertis are blank and i cannot configure the widget, layout too.
why?

@alejandroautalan
Copy link
Owner

Hello, thanks for trying pygubu.

Please post the following information:

  • OS version
  • Python version
  • Customtkinter version
  • pygubu-designer version
  • if possible, a screenshot of the issue.

Regards
Alejandro A.

@OtherwisePitt
Copy link
Author

hi,
windows 11;
Python 3.12.3;
CTK 5.2.2;
pygubu
Screenshot 2024-05-02 211622
0.39.1

@alejandroautalan
Copy link
Owner

Please install pillow and try again:

pip3 install pillow

Let me know if this works.
Regards

Alejandro A

@OtherwisePitt
Copy link
Author

Requirement already satisfied

@alejandroautalan
Copy link
Owner

alejandroautalan commented May 2, 2024

Hello, thanks for your reply.

I can't reproduce your problem. Try running pygubu-designer from console command, and post any error messages.

python -m pygubudesigner

Also post any error messages shown in the pygubu-designer "Messages" bottom area.

Regards
Alejandro A.

@OtherwisePitt
Copy link
Author

OtherwisePitt commented May 4, 2024

got this error when i chose CTK from pygubu:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\tkinter_init_.py", line 1967, in call
return self.func(*args)
^^^^^^^^^^^^^^^^
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubudesigner\services\widgets\treecomponentpalette.py", line 174, in on_widgetlist_dclick
self.on_add_widget_event(classname)
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubudesigner\services\widgets\treecomponentpalette.py", line 178, in on_add_widget_event
self.on_add_widget(cname)
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubudesigner\main.py", line 536, in on_add_widget_event
self.tree_editor.add_widget(classname)
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubudesigner\uitreeeditor.py", line 985, in add_widget
self.draw_widget(item)
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubudesigner\uitreeeditor.py", line 502, in draw_widget
self.previewer.draw(item, widget_id, uidef, wclass)
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubudesigner\preview\helper.py", line 198, in draw
preview.update(widget_id, uidefinition)
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubudesigner\preview\preview.py", line 160, in update
self._preview_widget = self.create_preview_widget(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubudesigner\preview\preview.py", line 181, in create_preview_widget
widget = self.builder.get_object(widget_id, parent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubu\builder.py", line 168, in get_object
bobject = self._realize(root, wmeta, extra_init_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubu\builder.py", line 263, in realize
parent.realize(master, extra_init_args)
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubu\component\builderobject.py", line 143, in realize
self.widget = self.class
(master, **args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pygubu\plugins\pygubu\designer\basehelpers.py", line 13, in init
super().init(master, **kw)
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\customtkinter\windows\widgets\ctk_frame.py", line 56, in init
self._canvas = CTkCanvas(master=self,
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\customtkinter\windows\widgets\core_rendering\ctk_canvas.py", line 31, in init
super().init(*args, **kwargs)
File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ttkbootstrap\style.py", line 5169, in init__wrapper
func(self, *args, **kwargs)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\tkinter_init
.py", line 2764, in init
Widget.init(self, master, 'canvas', cnf, kw)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\tkinter_init
.py", line 2648, in init
self.tk.call(
_tkinter.TclError: bad screen distance "400.0"

@alejandroautalan
Copy link
Owner

alejandroautalan commented May 5, 2024

Hello, thanks for the info.

File "C:\Users\torto\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ttkbootstrap\style.py", line 5169, in init__wrapper
func(self, *args, **kwargs)

You have ttkbootstrap installed. Can you try in an environment without ttkbootstrap?.

Also, are you setting that "400.0", or is coming directly from the error?

Maybe ttkbootstrap is generating all this behavior. I will continue with more tests.

Regards
Alejandro A.

@alejandroautalan
Copy link
Owner

UPDATE

I was able to reproduce the issue.
Pygubu-designer loads ttkbootstrap to be able to list the themes (since it is installed)
But this is causing the error. ttkbootstrap and customtkinter don't work well together.

Uninstall ttkbootstrap if you want to use customtkinter.

Regards
Alejandro A.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants