Example #1
0
def createQuitButton(parent, text=''):

  if not text:
    text = ''

  b = Button(parent, text=text, command=sys.exit)
  
  if not text:
    b.cancelIcon = Tkinter.PhotoImage(file=os.path.join(gfxDir,'cancel.gif'))
    b.config(image=b.cancelIcon, activebackground=b.cget('bg'))

  return b
Example #2
0
def createDismissButton(parent, dismiss_text = '', dismiss_cmd = None):

  if (not dismiss_text):
    dismiss_text = ''

  if (not dismiss_cmd):
    popup = parent
    while (not hasattr(popup, 'top')):
      popup = popup.parent
    dismiss_cmd = popup.close

  b = Button(parent, text=dismiss_text, command=dismiss_cmd)
  if not dismiss_text:
    b.cancelIcon = Tkinter.PhotoImage(file=os.path.join(gfxDir,'cancel.gif'))
    b.config(image=b.cancelIcon, activebackground=b.cget('bg'))

  return b