From: Greg M. <gr...@in...> - 2004-05-05 13:10:54
|
Julia, I just tried this on the command line and was able to display icons on a Pmw.MainMenuBar, using similar code to yours. Note that you must be very careful that your self.icon reference does not get cleaned up. It must stay "alive" by being a member of an object that is not deleted until the menu is deleted (if ever). If it PphotoImage is deleted then the effect is similar to what you are describing - the image on the menu button disappears. My tests are on Linux, which may be different to what you are using. On Tue 04 May 2004 at 03:55:32PM -0400, Julia Ozerskiy wrote: > Hi, > > i am using Pmw's MainMenuBar and i want to have a menu named "Start" > with an icon. I use the following code, only the name of the menu > displayed in the gui reads "(Image)" as if trying to say that this menu > has an image: > > menubar = Pmw.MainMenuBar(mainWindow.root) > mainWindow.root.configure(menu = menubar) > self.icon=PhotoImage(file="./icons/Home24.gif") > menubar.addmenu('Start', '', traverseSpec='S', image=self.icon) > > > > Pmw.MenuBar can display icons, but i cannot use it as it does not > activate mnemonics for the main menus located directly on the menubar. > For example, pressing Ctl+S will not drop down the start menu. > > Any suggestions? > > Any suggestions? > -- Greg McFarlane "For the Millions, Not the Millionaires" |