You Are Here: Home » Programming » Tech
Setting custom label for ImageMenuItem widget with stock icon in pygtk
You may have wanted to change the label contents of the stock item which you attached into the ImageMenuItem widget, but couldn't find an easy way out to do it. We here present to you in simple steps a way to achieve this and set the label contents to anything you desire.
For example, you may wish to use the Help Icon with label content as 'Contents' rather than the default 'Help'.
The above lines creates for you a conventional Help menu item with label content 'Help''.
These above lines replace the word 'Help' with 'Contents'. You can use it with any stock icons and can set the label contents to anything you desire by altering :
item.get_children().set_label('<....Put anything you wish....> ')