Open brianlin725 opened 1 year ago
You have to shoe the code where you create the tree view and maybe show a screenshot of the whole window? Otherwise I can tell anything.
#Treeview
self.itemTree = ttk.Treeview(self.tabs.tab("Main"), selectmode = "browse")
self.itemTree["columns"] = ["item", "quantity", "price"]
ttk.Style().configure("TreeviewItem", rowheight = 30, font = (None, 50))
# formatting column
self.itemTree.column("#0", width=0, stretch=NO)
self.itemTree.column("item", anchor=W, width=120)
self.itemTree.column("quantity", anchor=E, width=70)
self.itemTree.column("price", anchor=E, width=70)
# Treeview headings
self.itemTree.heading("#0", text="", anchor=W)
self.itemTree.heading("item", text="Item", anchor=W)
self.itemTree.heading("quantity", text="Quantity", anchor=E)
self.itemTree.heading("price", text="Total Price", anchor=E)
# Grid the Tree
self.itemTree.grid(row = 0, column = 0, sticky = "nswe", padx = 0, pady = 0)
The testing button on the left is on the default setting and apparently, most of the tkinter widgets will be small compared to other widgets in customtkinter. I was able to change the textsize of the button but I wasn't when it comes to treeview.
The size of the tkinter widgets were all normal before the update
Looks fine to me, I think you are working on a HighDPI display with a scaling in the Windows settings >100%. And CustomTkinter widgets adapt to this scaling while tkinter widgets do not.
You can call
customtkinter.deactivate_automatic_dpi_awareness()
at the beginning, but this will result in a blurry rendering or the window being too small.
I added that and apparently, that didn't do anything. Tried putting it in different places in the code and still doesn't work. Here is the first few lines of the code
class App(customtkinter.CTk):
WIDTH = 900
HEIGHT = 650
BTN_COLOR = "#dbdbdb"
BTN_HOVER = "#8e8d8e"
BTN_TXT = "#111111"
def __init__(self):
customtkinter.deactivate_automatic_dpi_awareness()
super().__init__()
self.people = []
self.items = []
self.tabs = []
self.title("Main Test")
self.geometry(f"{App.WIDTH}x{App.HEIGHT}")
self.protocol("WM_DELETE_WINDOW", self.on_closing)
customtkinter.set_appearance_mode("Light")
...
I added that and apparently, that didn't do anything. Tried putting it in different places in the code and still doesn't work. Here is the first few lines of the code
class App(customtkinter.CTk): WIDTH = 900 HEIGHT = 650 BTN_COLOR = "#dbdbdb" BTN_HOVER = "#8e8d8e" BTN_TXT = "#111111" def __init__(self): customtkinter.deactivate_automatic_dpi_awareness() super().__init__() self.people = [] self.items = [] self.tabs = [] self.title("Main Test") self.geometry(f"{App.WIDTH}x{App.HEIGHT}") self.protocol("WM_DELETE_WINDOW", self.on_closing) customtkinter.set_appearance_mode("Light") ...
Its been a long time, so imagine you probably don't need this anymore, but I had the same problem and the solution that Tom Schimansky suggested worked really well.
I had to change just a detail, I import customtkinter as ctk, so the command changed too:
ctk.deactivate_automatic_dpi_awareness()
Worked, yes in fact the window is small, but all the widgets stay correctly positioned.
After updating customtkinter, the text in my treeview became unreasonably small and it is not changeable through the font argument in style configuration. Is there something in treeview that conflicts with the new update?