Tk

Shi Mu samrobertsmith at gmail.com
Sun Oct 30 16:21:39 EST 2005


How can I make the main menu come first, and after clicking test/just
try, "how are you" interface shows.

Thanks a lot!
from Tkinter import *
from Tkinter import _cnfmerge

class Dialog(Widget):
  def __init__(self, master=None, cnf={}, **kw):
      cnf = _cnfmerge((cnf, kw))
      self.widgetName = '__dialog__'
      Widget._setup(self, master, cnf)
      self.num = self.tk.getint(
              apply(self.tk.call,
                    ('tk_dialog', self._w,
                     cnf['title'], cnf['text'],
                     cnf['bitmap'], cnf['default'])
                    + cnf['strings']))
      try: Widget.destroy(self)
      except TclError: pass
  def destroy(self): pass

if __name__ == '__main__':

  q = Button(None, {'text': 'How are you',
                    Pack: {}})
  b1 = Listbox()
  b1.pack()

  c1 = Checkbutton(text="Check")
  c1.pack()

  q.mainloop()

from Tkinter import *
root =Tk()
menu=Menu(root)
root.config(menu=menu)
filemenu=Menu(menu)
menu.add_cascade(label="Test", menu=filemenu)
filemenu.add_command(label="Just Try")
filemenu.add_separator()
mainloop()



More information about the Python-list mailing list