* "shenye...@gmail.com" <shenye...@gmail.com>
| How do I give a fixed width to the whole option menu ?
Configure the -width of it > 0, and it will stay fixed size.
You could get the max length of all entries and use that as -width
(probably also checking for a sensible max width if there happen to be
very long entries).
HTH
R'
* "shenye...@gmail.com" <shenye...@gmail.com>
| On Thursday, October 28, 2021 at 4:18:52 PM UTC+8, Ralf Fassel wrote:
| > * "shenye...@gmail.com" <shenye...@gmail.com>
| > | How do I give a fixed width to the whole option menu ?
| > Configure the -width of it > 0, and it will stay fixed size.
| >
| > You could get the max length of all entries and use that as -width
| > (probably also checking for a sensible max width if there happen to be
| > very long entries).
| Yes I did, as the scripts below
| ==============
| set w_opt [eval tk_optionMenu .form.optionmenu_1 var1 $list 1]
| $w_opt configure -width 45
| =============
| But I then got the error message : unknown option "-width"
The manpage for tk_optionMenu says:
The return value from tk_optionMenu is the name of the menu
associated with pathName, so that the caller can change its
configuration options or manip- ulate it in other ways.
So try
.form.optionmenu_1 configure -width 45
instead (i.e. use the widget name you passed to tk_optionMenu, not the
return value).
HTH
R'
In the pull-down menu, they just all appear aligned to the left. After the option is selected, the string in the box are all center aligned.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 463 |
Nodes: | 16 (2 / 14) |
Uptime: | 156:55:07 |
Calls: | 9,384 |
Calls today: | 4 |
Files: | 13,561 |
Messages: | 6,095,919 |