Tk Source Code

View Ticket
Login
Ticket UUID: 1245475
Title: Using text and image on menu entry - extra space added.
Type: Bug Version: obsolete: 8.4.11
Submitter: bluetit Created on: 2005-07-26 19:28:44
Subsystem: 10. Generic Menus Assigned To: tmh
Priority: 5 Medium Severity:
Status: Pending Last Modified: 2026-09-22 21:06:23
Resolution: Works for Me Closed By:
    Closed on:
Description:
Hi,
When giving a menu entry both text and an image,
significant extra space (~20 pixels) is added to the
right, eg with

menu .m
.m add command -label entry -image entry -compound center

I think the problem is with compound, because when
giving a button image and text and using -compound
center, you get an extra pixel border all around the
button.

Tom
User Comments: serhiy.storchaka added on 2026-09-22 21:06:23:

I cannot reproduce a defect here, with 8.4.11, 8.6 and 9.1, on X11 and on Windows.

With -compound center a menu entry takes the larger of the text and the image in each dimension, so an image wider than the text makes the entry wider: a 60x24 image gives 84 pixels against 59 for the text alone.

A button adds -padx and -pady around what it displays, which is what looks like a border; the manual says that padding is ignored only when a widget displays an image alone, and a compound button displays text. With -padx 0 -pady 0 its size is exactly the larger of the text and the image.