israel-dryer / ttkbootstrap

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

DateEntry popup is very narrow, numbers cannot be seen #444

Open Babber opened 1 year ago

Babber commented 1 year ago

Desktop (please complete the following information):

ttkbootstrap version: 1.10.1 OS: Linux Mint

Describe the bug

When clicking on the button of the DateEntry widget, a calendar popup appears, but it is so narrow that only the first digits of the numbers can be seen. The button for moving to the next month is also off the popup. Maybe minsize in the DatePickerDialog class is set too low? Could this be tweaked without editing the source code?..

To Reproduce

import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from datetime import date
my_w = ttk.Window()
my_w.geometry("420x300")  # width and height
dt2=date(2023,12,30) # start date 

de = ttk.DateEntry(dateformat='%Y-%m-%d',firstweekday=2,startdate=dt2)
de.grid(row=1, column=1, padx=10, pady=20)

my_w.mainloop()

Expected behavior

To see all the days of the month that is both digits, to see the whole name of the current month followed by the button to jump to the next month.

Screenshots

Screenshot from 2023-03-20 13-43-30

Additional context

My temporary fix is to change minsize=(226, 1) to minsize=(452, 1) in dialogs.py.

Babber commented 1 year ago

I have tried to set the scaling with my_w.tk.call('tk', 'scaling', 2) in the above example, but it did not help. In my view, minsize (or its first element) should be multiplied by a scaling factor, like root.winfo_screenwidth()/root.winfo_screenmmwidth()*25.4/72. Otherwise the numbers in the widget won't be visible on high DPI displays, which are mostly scaled.

Babber commented 1 year ago

Or maybe the scaling should rather be done by something like my_w.tk.call('tk', 'scaling', tkFont.Font(root=my_w, name='TkDefaultFont', size=10, exists=True).measure('0')/8) where import tkinter.font as tkFont.