israel-dryer / ttkbootstrap

A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
MIT License
1.78k stars 358 forks source link

Issue with ttkbootstrap.Checkbutton after Python 3.12 install #506

Closed louisgoodnews closed 2 months ago

louisgoodnews commented 8 months ago

Desktop (please complete the following information):

ttkbootstrap~=1.10.1 OS: Windows 11 Home 22H2

Describe the bug

When running code in which a ttkbootstrap.Checkbutton is implemented, my IDE (PyCharm 20230.2.3 Community Edition) seems to terminate the code's execution with this output: Process finished with exit code -1073741819 (0xC0000005). Nowhere else does this appear when running the code apart from when a ttkbootstrap.Checkbutton is implemented in the code such as this:

        checkbutton: ttkbootstrap.Checkbutton = ttkbootstrap.Checkbutton(
            bootstyle=self._bootstyle,
            master=checkbutton_frame,
            onvalue=True,
            offvalue=False,
            variable=self._boolean_var,
        )
        checkbutton.pack(
            padx=10,
            pady=5,
            side=LEFT,
        )

Commenting out these lines will result in the code running without any issue.

To Reproduce

Update your Python install to 3.12 and use PyCharm IDE Version 2023.2.3 and implement a ttkbootstrap.Checkbutton in your code such as this:

        checkbutton: ttkbootstrap.Checkbutton = ttkbootstrap.Checkbutton(
            bootstyle=self._bootstyle,
            master=checkbutton_frame,
            onvalue=True,
            offvalue=False,
            variable=self._boolean_var,
        )
        checkbutton.pack(
            padx=10,
            pady=5,
            side=LEFT,
        )

Run the code and observe the output: Process finished with exit code -1073741819 (0xC0000005)

Expected behavior

No response

Screenshots

No response

Additional context

No response

louisgoodnews commented 8 months ago

Something interesting I discovered:

When using the same setup, but changing the bootstyle to "round-toggle" seems to have the effect of the application not crashing:

checkbutton: ttkbootstrap.Checkbutton = ttkbootstrap.Checkbutton( bootstyle=f"{self._bootstyle}-round-toggle", master=checkbutton_frame, onvalue=True, offvalue=False, variable=self._boolean_var, ) checkbutton.pack( padx=10, pady=5, side=LEFT, )

sturdy-robot commented 2 months ago

I tried it with my project, where I have implemented a Checkbutton here: https://github.com/openfootmanager/openfootmanager/blob/2c4f7f17724e1ffb1159e5024c043417f4eb6106/ofm/ui/pages/debug_match/player_details_tab.py starting on line 112, and I'm unable to reproduce your results. I'm running Python 3.12.0 as well. The only thing I did different was use .grid() instead of .pack().

What's the type of the self._bootstyle variable?

louisgoodnews commented 2 months ago

Thank you for your reply. I have noticed, that there must have been an update, maybe to ttkbootstrap or somewhere else, as I myself am no longer able to reproduce the issue. So I think it might be best to close the issue. As for the self._bootstyle variable it is a str of "primary" used in the constructor of the class of the ui I was building.