Issue #6615: logging: Used weak references in internal handler list. Thanks to flox...
[python.git] / Demo / tix / samples / BtnBox.py
blobaf2a2a8753887da54c3474bafcaa43bafd9e7277
1 # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
3 # $Id$
5 # Tix Demostration Program
7 # This sample program is structured in such a way so that it can be
8 # executed from the Tix demo program "tixwidgets.py": it must have a
9 # procedure called "RunSample". It should also have the "if" statment
10 # at the end of this file so that it can be run as a standalone
11 # program.
13 # This file demonstrates the use of the tixButtonBox widget, which is a
14 # group of TK buttons. You can use it to manage the buttons in a dialog box,
15 # for example.
18 import Tix
20 def RunSample(w):
21 # Create the label on the top of the dialog box
23 top = Tix.Label(w, padx=20, pady=10, bd=1, relief=Tix.RAISED,
24 anchor=Tix.CENTER, text='This dialog box is\n a demonstration of the\n tixButtonBox widget')
26 # Create the button box and add a few buttons in it. Set the
27 # -width of all the buttons to the same value so that they
28 # appear in the same size.
30 # Note that the -text, -underline, -command and -width options are all
31 # standard options of the button widgets.
33 box = Tix.ButtonBox(w, orientation=Tix.HORIZONTAL)
34 box.add('ok', text='OK', underline=0, width=5,
35 command=lambda w=w: w.destroy())
36 box.add('close', text='Cancel', underline=0, width=5,
37 command=lambda w=w: w.destroy())
38 box.pack(side=Tix.BOTTOM, fill=Tix.X)
39 top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
41 if __name__ == '__main__':
42 root = Tix.Tk()
43 RunSample(root)
44 root.mainloop()