CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

CTkToplevel not displaying

Open legopitstop opened this issue 3 years ago • 8 comments

CTkToplevel is not displaying when the resizeable method is used.

customtkinter: 4.6.3 IOS: Windows 10

Steps To Reproduce

  1. Run the below code in a python file.
  2. Click the button in the main window
  3. Nothing happens
  4. Remove the resizable method in the toplevel function.
  5. The toplevel window properly displays

Observed Results

  • Console does not return any errors.
  • Changing the values inside the resizeable method does nothing.
  • Works fine on MacOS

Code:

from customtkinter import CTk, CTkToplevel, CTkButton

root = CTk()
root.resizable(False, False)

def toplevel():
    print('OPEN')
    top = CTkToplevel(root)
    top.resizable(False, False) # Prevents window from opening
    button = CTkButton(top, command=top.destroy)
    button.pack(padx=20, pady=20)

button = CTkButton(root, command=toplevel)
button.pack(padx=20, pady=20)
root.mainloop()

legopitstop avatar Sep 21 '22 00:09 legopitstop

I ran the code you posted, it works fine (macOS). Maybe try it this way, using a class with ck.CTk inheritance:

import customtkinter as ck

ck.set_appearance_mode("dark")  # Options: light, dark, auto
ck.set_default_color_theme("dark-blue")  # Options: blue, dark-blue, green

class App(ck.CTk):
    def __init__(self, *args, fg_color="default_theme", **kwargs):
        super().__init__(*args, fg_color=fg_color, **kwargs)
        self.resizable(False, False)
        self.button = ck.CTkButton(self, command=self.toplevel)
        self.button.pack(padx=20, pady=20)

    def toplevel(self):
        print("OPEN")
        top = ck.CTkToplevel(self)
        top.resizable(False, False)  # Prevents window from opening
        button = ck.CTkButton(top, command=top.destroy)
        button.pack(padx=20, pady=20)

    def on_closing(self, event=0):
        self.destroy()
        exit(0)

    def start(self):
        self.mainloop()


if __name__ == "__main__":
    app = App()
    app.start()

LineIndent avatar Sep 21 '22 19:09 LineIndent

The ck.CTk inheritance still didnt work. Must be a windows 10 issue.

legopitstop avatar Sep 21 '22 20:09 legopitstop

Its only a Windows 10 issue, I fixed it, and it will build a new release version soon.

TomSchimansky avatar Sep 22 '22 11:09 TomSchimansky

Sorry,I'm on Windows 11,but the problem still exist even though the customtkinter version have up to date...

Its only a Windows 10 issue, I fixed it, and it will build a new release version soon.

Corporation001 avatar Oct 02 '22 16:10 Corporation001

Its a problem for all Windows versions, and I didn't upload a new version yet, but I will do it maybe tomorrow when some other changes are also ready.

TomSchimansky avatar Oct 02 '22 16:10 TomSchimansky

Its a problem for all Windows versions, and I didn't upload a new version yet, but I will do it maybe tomorrow when some other changes are also ready.

Thank you!

Corporation001 avatar Oct 02 '22 20:10 Corporation001

When the fix will be updated,please?

yuseffathi avatar Oct 26 '22 15:10 yuseffathi

Just here to say that the issue still persists. The standard tkinter.Toplevel() works fine but customtkinter.CTkToplevel() still doesn't work with the resizable parameters.

OffApparition avatar Nov 30 '22 12:11 OffApparition

Should be fixed with version 5.0.0.

TomSchimansky avatar Dec 06 '22 22:12 TomSchimansky