enhanced geometry string parsing for CTk and CTkToplevel #345 #287

This commit is contained in:
Tom Schimansky
2022-08-05 20:38:05 +02:00
parent 73ab410a96
commit deebaa9163
4 changed files with 118 additions and 60 deletions

View File

@ -12,7 +12,7 @@ class App(customtkinter.CTk):
super().__init__()
self.title("CustomTkinter complex_example.py")
self.geometry(f"{920}x{500}")
self.geometry(f"{920}x{500}-100-100")
self.protocol("WM_DELETE_WINDOW", self.on_closing) # call .on_closing() when app gets closed
# configure grid layout (4x4)

View File

@ -0,0 +1,35 @@
import customtkinter
customtkinter.set_window_scaling(1.3)
app = customtkinter.CTk()
app.geometry("300x300")
app.geometry("-100-100")
app.geometry("+-100+-100")
app.geometry("+100+100")
app.geometry("300x300-100-100")
app.geometry("300x300+-100+-100")
app.geometry("300x300+100+100")
app.geometry("400x400")
app.geometry("+400+400")
app.update()
print(app.geometry())
assert app.geometry() == "400x400+400+400"
toplevel = customtkinter.CTkToplevel(app)
toplevel.geometry("300x300")
toplevel.geometry("-100-100")
toplevel.geometry("+-100+-100")
toplevel.geometry("+100+100")
toplevel.geometry("300x300-100-100")
toplevel.geometry("300x300+-100+-100")
toplevel.geometry("300x300+100+100")
toplevel.geometry("300x300")
toplevel.geometry("+500+500")
toplevel.update()
print(toplevel.geometry())
assert toplevel.geometry() == "300x300+500+500"
app.mainloop()