Tk Source Code

View Ticket
Login
Ticket UUID: 3598564
Title: wm maxsize does not take into account task bar on Windows
Type: Bug Version: current: 8.6.0
Submitter: nalimilan Created on: 2012-12-26 22:59:06
Subsystem: 62. Geometry Functions Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-11-13 12:57:59
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-11-13 12:57:59
Description:
On my Windows 7 box with a 768px screen, wm maxsize returns 750. This does not take into account the size of the task bar, which means that natural height of windows can be more than the \"usable\" screen height, making the window appear _behind_ the task bar (see screenshot).

This problem is visible e.g. when one widget has a fixed height, but the one stacked below it does not. In that case, the window\'s natural size should be limited to the usable screen size so that it stops right above the task bar. What happens at the moment is that the second widget, which has no fixed size, only shrinks when the window would exceed the value of \"wm maxsize\". This example (used in the screenshot) illustrates the problem:
toplevel .w
text .w.t1 -height 25
text .w.t2
grid .w.t1
grid .w.t2
update
wm geometry .w
wm maxsize .w

(Just change \"-height 25\" so that the first text box takes the most part of your screen\'s height.)


This problem also happened with Tk 8.5. I have not tested this under Windows 7 SP1 (upgrade bug).
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-11-13 12:57:59:

Serhiy, many thanks! Merged into main, core-9-0-branch, and core-8-6-branch by commits [da6ce0c6], [d00d9c55], and [7c447165].


serhiy.storchaka added on 2026-11-05 14:32:16:

Still reproducible on Windows 11: the window extends under the taskbar and past the bottom of the screen. X11 has the same problem: the default maximum size is the size of the display less fixed 15 and 30 pixels for the decorations, which are wrong for most modern window managers, and Tk did not limit the natural size of a window by it at all.

Fixed on branch default-maxsize-workarea: the default wm maxsize is the work area less the actual decorations of the window, that of the monitor on Windows and _NET_WORKAREA on X11, and the natural size of a toplevel is limited by it. On macOS the default maximum size already excluded the menu bar and the Dock; the natural size of a toplevel is now limited by it too. This is not tested on macOS.


nalimilan added on 2012-12-27 05:59:10:

File Added - 458416: window under taskbar example.jpg

Attachments: