##################################################################### ##################################################################### # # # File: MainMenu.py # # Date: 16-Mar-2006 # # Desc: Form for the main menu of the CDAT demo application. # # # ##################################################################### ##################################################################### import Tkinter import Pmw import sys import os import DemoSet import About ############################################################# # Class: MainMenu # # Descr: The main for of the CDAT demo app. # ############################################################# class MainDisplay (Tkinter.Frame): def __init__ (self, master, buttons, onBtnLeave): Tkinter.Frame.__init__ (self, master) # Add the background image. fname = os.path.join (sys.exec_prefix, 'bin/images', 'main_background.gif') self._bgImage = Tkinter.PhotoImage (file = fname) self._bgPhoto = Tkinter.Label (self, image = self._bgImage, relief='sunken') self._bgPhoto.grid (rowspan=40, columnspan=11) # Create buttons. btn = {} for name, col, row, cback, enter in buttons: btn [name] = Tkinter.Button (self, width = 20, text = name, command = cback) btn [name].bind ('', enter) btn [name].bind ('', onBtnLeave) btn [name].grid (row=row, column=col, sticky='w') def _onDemoClose (self, type): self._demos[type].withdraw() def getWidth (self): return self._bgImage.width() def getHeight (self): return self._bgImage.height()